Skip to content

Commit 3023431

Browse files
committed
chore: postinstall for dependabot template-oss PR
1 parent 4863862 commit 3023431

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ name: Release
44

55
on:
66
workflow_dispatch:
7+
inputs:
8+
release-pr:
9+
description: a release PR number to rerun release jobs on
10+
type: string
711
push:
812
branches:
913
- main
@@ -53,7 +57,7 @@ jobs:
5357
env:
5458
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5559
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 }}"
5761
- name: Post Pull Request Comment
5862
if: steps.release.outputs.pr-number
5963
uses: actions/github-script@v6
@@ -76,7 +80,7 @@ jobs:
7680
body += `Release workflow run: ${workflow.html_url}\n\n#### Force CI to Update This Release\n\n`
7781
body += `This PR will be updated and CI will run for every non-\`chore:\` commit that is pushed to \`main\`. `
7882
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\`\`\``
8084
8185
if (commentId) {
8286
await github.rest.issues.updateComment({ owner, repo, comment_id: commentId, body })
@@ -291,14 +295,17 @@ jobs:
291295
}
292296
293297
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'))
295301
296302
for (const comment of releaseComments) {
303+
console.log(`Release comment: ${JSON.stringify(comment, null, 2)}`)
297304
await github.rest.issues.deleteComment({ owner, repo, comment_id: comment.id })
298305
}
299306
300307
const runUrl = `https://github.com/${owner}/${repo}/actions/runs/${runId}`
301-
await github.rest.issues.createComment({
308+
await github.rest.issues.createComment({
302309
owner,
303310
repo,
304311
issue_number,
@@ -378,10 +385,14 @@ jobs:
378385
with:
379386
script: |
380387
const { PR_NUMBER: issue_number, RESULT } = process.env
381-
const { repo: { owner, repo } } = context
388+
const { runId, repo: { owner, repo } } = context
382389
383390
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+
)
385396
386397
if (updateComment) {
387398
console.log('Found comment to update:', JSON.stringify(updateComment, null, 2))

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
},
5252
"templateOSS": {
5353
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
54-
"version": "4.11.3"
54+
"version": "4.11.4"
5555
},
5656
"tap": {
5757
"statements": 88,

0 commit comments

Comments
 (0)