Repository navigation
232 lines (216 loc) · 8.01 KB
/
Copy pathon_comment.yaml
File metadata and controls
232 lines (216 loc) · 8.01 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: "On Comment"
on:
issue_comment:
types: [created]
permissions:
contents: write
issues: write
pull-requests: write
jobs:
# This job always runs to prevent GHA from marking the run as failed when
# all other jobs are skipped.
noop:
runs-on: ubuntu-latest
steps:
- run: echo "No-op"
parse_comment:
runs-on: ubuntu-latest
if: contains(github.event.comment.body, '/')
outputs:
command: ${{ steps.parse.outputs.command }}
issue_number: ${{ steps.parse.outputs.issue_number }}
pr_number: ${{ steps.parse.outputs.pr_number }}
backports: ${{ steps.parse.outputs.backports }}
release_branch: ${{ steps.parse.outputs.release_branch }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.14"
- name: Parse comment
id: parse
env:
COMMENT_BODY: ${{ github.event.comment.body }}
IS_PR: "${{ github.event.issue.pull_request != null }}"
EVENT_NUMBER: "${{ github.event.issue.number }}"
HAS_RELEASE_LABEL: "${{ contains(github.event.issue.labels.*.name, 'type: release') }}"
HAS_BACKPORT_LABEL: "${{ contains(github.event.issue.labels.*.name, 'type: backport-pr') }}"
COMMENT_ID: "${{ github.event.comment.id }}"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: .github/workflows/on_comment.py
call_create_rc:
needs: parse_comment
if: needs.parse_comment.outputs.command == 'create-rc'
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: "Dispatch: Release: Create RC"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: ${{ needs.parse_comment.outputs.release_branch }}
ISSUE: ${{ needs.parse_comment.outputs.issue_number }}
COMMENT_ID: "${{ github.event.comment.id }}"
AUTHOR_NAME: ${{ github.actor }}
AUTHOR_EMAIL: "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
run: |
gh workflow run release_create_rc.yaml \
--repo "$REPO" \
--ref "$BRANCH" \
--raw-field "issue=$ISSUE" \
--raw-field "comment_id=$COMMENT_ID" \
--raw-field "author_name=$AUTHOR_NAME" \
--raw-field "author_email=$AUTHOR_EMAIL"
call_prepare_complete:
needs: parse_comment
if: needs.parse_comment.outputs.command == 'prepare-complete'
uses: ./.github/workflows/release_complete_prepare.yaml
with:
pr: ${{ needs.parse_comment.outputs.pr_number }}
issue: ${{ needs.parse_comment.outputs.issue_number }}
secrets: inherit
call_create_release_branch:
needs: parse_comment
if: needs.parse_comment.outputs.command == 'create-release-branch'
uses: ./.github/workflows/release_create_release_branch.yaml
with:
issue: ${{ needs.parse_comment.outputs.issue_number }}
secrets: inherit
call_prepare:
needs: parse_comment
if: needs.parse_comment.outputs.command == 'prepare'
uses: ./.github/workflows/release_prepare.yaml
with:
issue: ${{ needs.parse_comment.outputs.issue_number }}
secrets: inherit
call_add_backports:
needs: parse_comment
if: |
needs.parse_comment.outputs.command == 'add-backports' ||
needs.parse_comment.outputs.command == 'pr-backport'
uses: ./.github/workflows/release_add_backports.yaml
with:
prs: ${{ needs.parse_comment.outputs.command == 'pr-backport' && needs.parse_comment.outputs.pr_number || needs.parse_comment.outputs.backports }}
issue: ${{ needs.parse_comment.outputs.issue_number }}
secrets: inherit
call_process_backports_after_add:
needs: [parse_comment, call_add_backports]
if: needs.parse_comment.outputs.command == 'add-backports'
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: "Dispatch: Release: Process Backports"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: ${{ needs.parse_comment.outputs.release_branch }}
ISSUE: ${{ needs.parse_comment.outputs.issue_number }}
COMMENT_ID: "${{ github.event.comment.id }}"
run: |
gh workflow run release_process_backports.yaml \
--repo "$REPO" \
--ref "$BRANCH" \
--raw-field "issue=$ISSUE" \
--raw-field "comment_id=$COMMENT_ID"
call_process_backports_only:
needs: parse_comment
if: needs.parse_comment.outputs.command == 'process-backports'
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: "Dispatch: Release: Process Backports"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: ${{ needs.parse_comment.outputs.release_branch }}
ISSUE: ${{ needs.parse_comment.outputs.issue_number }}
COMMENT_ID: "${{ github.event.comment.id }}"
run: |
gh workflow run release_process_backports.yaml \
--repo "$REPO" \
--ref "$BRANCH" \
--raw-field "issue=$ISSUE" \
--raw-field "comment_id=$COMMENT_ID"
call_sync_changelog:
needs: parse_comment
if: needs.parse_comment.outputs.command == 'sync-changelog'
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: "Dispatch: Release: Sync Changelog"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: ${{ needs.parse_comment.outputs.release_branch }}
ISSUE: ${{ needs.parse_comment.outputs.issue_number }}
run: |
gh workflow run release_sync_changelog.yaml \
--repo "$REPO" \
--ref "$BRANCH" \
--raw-field "issue=$ISSUE"
call_promote:
needs: parse_comment
if: needs.parse_comment.outputs.command == 'promote'
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: "Dispatch: Release: Promote"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: ${{ needs.parse_comment.outputs.release_branch }}
ISSUE: ${{ needs.parse_comment.outputs.issue_number }}
AUTHOR_NAME: ${{ github.actor }}
AUTHOR_EMAIL: "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
run: |
gh workflow run release_promote.yaml \
--repo "$REPO" \
--ref "$BRANCH" \
--raw-field "issue=$ISSUE" \
--raw-field "author_name=$AUTHOR_NAME" \
--raw-field "author_email=$AUTHOR_EMAIL"
call_backport_prepare:
needs: parse_comment
if: needs.parse_comment.outputs.command == 'backport-prepare'
uses: ./.github/workflows/backport_prepare.yaml
with:
issue: ${{ needs.parse_comment.outputs.issue_number }}
secrets: inherit
call_backport_create_releases:
needs: parse_comment
if: needs.parse_comment.outputs.command == 'backport-create-releases'
uses: ./.github/workflows/backport_create_releases.yaml
with:
issue: ${{ needs.parse_comment.outputs.issue_number }}
secrets: inherit
report_failure:
needs:
- parse_comment
- call_create_rc
- call_prepare_complete
- call_create_release_branch
- call_prepare
- call_add_backports
- call_process_backports_after_add
- call_process_backports_only
- call_sync_changelog
- call_promote
- call_backport_prepare
- call_backport_create_releases
if: always() && needs.parse_comment.result == 'success' && contains(needs.*.result, 'failure')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.14"
- name: Post failure comment
env:
COMMAND: "${{ needs.parse_comment.outputs.command }}"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: .github/workflows/on_comment.py --report-failure