@@ -4,6 +4,10 @@ name: Release
4
4
5
5
on :
6
6
workflow_dispatch :
7
+ inputs :
8
+ release-pr :
9
+ description : a release PR number to rerun release jobs on
10
+ type : string
7
11
push :
8
12
branches :
9
13
- main
53
57
env :
54
58
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
55
59
run : |
56
- npx --offline template-oss-release-please ${{ github.ref_name }} ${{ github.event_name }}
60
+ npx --offline template-oss-release-please " ${{ github.ref_name }}" " ${{ inputs.release-pr }}"
57
61
- name : Post Pull Request Comment
58
62
if : steps.release.outputs.pr-number
59
63
uses : actions/github-script@v6
76
80
body += `Release workflow run: ${workflow.html_url}\n\n#### Force CI to Update This Release\n\n`
77
81
body += `This PR will be updated and CI will run for every non-\`chore:\` commit that is pushed to \`main\`. `
78
82
body += `To force CI to update this PR, run this command:\n\n`
79
- body += `\`\`\`\ngh workflow run release.yml -r ${REF_NAME} -R ${owner}/${repo}\n\`\`\``
83
+ body += `\`\`\`\ngh workflow run release.yml -r ${REF_NAME} -R ${owner}/${repo} -f release-pr=${issue_number} \n\`\`\``
80
84
81
85
if (commentId) {
82
86
await github.rest.issues.updateComment({ owner, repo, comment_id: commentId, body })
@@ -291,14 +295,17 @@ jobs:
291
295
}
292
296
293
297
const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number })
294
- const releaseComments = comments.filter(c => c.user.login === 'github-actions[bot]' && c.body.includes('Release is at'))
298
+ .then(cs => cs.map(c => ({ id: c.id, login: c.user.login, body: c.body })))
299
+ console.log(`Found comments: ${JSON.stringify(comments, null, 2)}`)
300
+ const releaseComments = comments.filter(c => c.login === 'github-actions[bot]' && c.body.includes('Release is at'))
295
301
296
302
for (const comment of releaseComments) {
303
+ console.log(`Release comment: ${JSON.stringify(comment, null, 2)}`)
297
304
await github.rest.issues.deleteComment({ owner, repo, comment_id: comment.id })
298
305
}
299
306
300
307
const runUrl = `https://github.com/${owner}/${repo}/actions/runs/${runId}`
301
- await github.rest.issues.createComment({
308
+ await github.rest.issues.createComment({
302
309
owner,
303
310
repo,
304
311
issue_number,
@@ -378,10 +385,14 @@ jobs:
378
385
with :
379
386
script : |
380
387
const { PR_NUMBER: issue_number, RESULT } = process.env
381
- const { repo: { owner, repo } } = context
388
+ const { runId, repo: { owner, repo } } = context
382
389
383
390
const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number })
384
- const updateComment = comments.find(c => c.user.login === 'github-actions[bot]' && c.body.startsWith('## Release Workflow\n\n'))
391
+ const updateComment = comments.find(c =>
392
+ c.user.login === 'github-actions[bot]' &&
393
+ c.body.startsWith('## Release Workflow\n\n') &&
394
+ c.body.includes(runId)
395
+ )
385
396
386
397
if (updateComment) {
387
398
console.log('Found comment to update:', JSON.stringify(updateComment, null, 2))
0 commit comments