Skip to content

Commit ae4451d

Browse files
authored
ci: Add some additional GH project automation (#13629)
Follow up to #13608, after some tweaks and a rebase! * When a PR is opened in draft mode, move to "In Progress" on the board * When a PR is opened for review, move to "In Review" on the board * When a PR is closed but not merged, move it directly to "Done" (instead of "Ready for Release") Note that for now, this only applies to PRs that are on the board themselves, not to PRs linked to an issue.
1 parent a2d1b2c commit ae4451d

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed
+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: "Automation: Update GH Project"
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
- opened
7+
- reopened
8+
- ready_for_review
9+
- converted_to_draft
10+
11+
jobs:
12+
# Check if PR is in project
13+
check_project:
14+
name: Check if PR is in project
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check if PR is in project
18+
continue-on-error: true
19+
id: check_project
20+
uses: github/update-project-action@f980378bc179626af5b4e20ec05ec39c7f7a6f6d
21+
with:
22+
github_token: ${{ secrets.GH_PROJECT_AUTOMATION }}
23+
organization: getsentry
24+
project_number: 31
25+
content_id: ${{ github.event.pull_request.node_id }}
26+
field: Status
27+
operation: read
28+
29+
- name: If project field is read, set is_in_project to 1
30+
if: steps.check_project.outputs.field_read_value
31+
id: is_in_project
32+
run: echo "is_in_project=1" >> "$GITHUB_OUTPUT"
33+
34+
outputs:
35+
is_in_project: ${{ steps.is_in_project.outputs.is_in_project || '0' }}
36+
37+
# When a PR is a draft, it should go into "In Progress"
38+
mark_as_in_progress:
39+
name: "Mark as In Progress"
40+
needs: check_project
41+
if: |
42+
needs.check_project.outputs.is_in_project == '1'
43+
&& (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'converted_to_draft')
44+
&& github.event.pull_request.draft == true
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Update status to in_progress
48+
uses: github/update-project-action@f980378bc179626af5b4e20ec05ec39c7f7a6f6d
49+
with:
50+
github_token: ${{ secrets.GH_PROJECT_AUTOMATION }}
51+
organization: getsentry
52+
project_number: 31
53+
content_id: ${{ github.event.pull_request.node_id }}
54+
field: Status
55+
value: "🏗 In Progress"
56+
57+
# When a PR is not a draft, it should go into "In Review"
58+
mark_as_in_review:
59+
name: "Mark as In Review"
60+
needs: check_project
61+
if: |
62+
needs.check_project.outputs.is_in_project == '1'
63+
&& (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'ready_for_review')
64+
&& github.event.pull_request.draft == false
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Update status to in_review
68+
id: update_status
69+
uses: github/update-project-action@f980378bc179626af5b4e20ec05ec39c7f7a6f6d
70+
with:
71+
github_token: ${{ secrets.GH_PROJECT_AUTOMATION }}
72+
organization: getsentry
73+
project_number: 31
74+
content_id: ${{ github.event.pull_request.node_id }}
75+
field: Status
76+
value: "👀 In Review"
77+
78+
# By default, closed PRs go into "Ready for Release"
79+
# But if they are closed without merging, they should go into "Done"
80+
mark_as_done:
81+
name: "Mark as Done"
82+
needs: check_project
83+
if: |
84+
needs.check_project.outputs.is_in_project == '1'
85+
&& github.event.action == 'closed' && github.event.pull_request.merged == false
86+
runs-on: ubuntu-latest
87+
steps:
88+
- name: Update status to done
89+
id: update_status
90+
uses: github/update-project-action@f980378bc179626af5b4e20ec05ec39c7f7a6f6d
91+
with:
92+
github_token: ${{ secrets.GH_PROJECT_AUTOMATION }}
93+
organization: getsentry
94+
project_number: 31
95+
content_id: ${{ github.event.pull_request.node_id }}
96+
field: Status
97+
value: "✅ Done"
98+

0 commit comments

Comments
 (0)