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