Skip to content

Commit 8f11f7c

Browse files
committedFeb 8, 2023
chore: postinstall for dependabot template-oss PR
1 parent 344f316 commit 8f11f7c

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed
 

‎.github/workflows/release.yml

+17-6
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"author": "GitHub Inc.",
5454
"templateOSS": {
5555
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
56-
"version": "4.11.3",
56+
"version": "4.11.4",
5757
"engines": ">=10",
5858
"ciVersions": [
5959
"10.0.0",

0 commit comments

Comments
 (0)
Please sign in to comment.