Skip to content

Commit d583e92

Browse files
committed
chore: postinstall for dependabot template-oss PR
1 parent 8e51d93 commit d583e92

File tree

4 files changed

+28
-18
lines changed

4 files changed

+28
-18
lines changed

.github/workflows/post-dependabot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ jobs:
4848
run: |
4949
dependabot_dir="${{ steps.metadata.outputs.directory }}"
5050
if [[ "$dependabot_dir" == "/" ]]; then
51-
echo "::set-output name=workspace::-iwr"
51+
echo "workspace=-iwr" >> $GITHUB_OUTPUT
5252
else
5353
# strip leading slash from directory so it works as a
5454
# a path to the workspace flag
55-
echo "::set-output name=workspace::-w ${dependabot_dir#/}"
55+
echo "workspace=-w ${dependabot_dir#/}" >> $GITHUB_OUTPUT
5656
fi
5757
5858
- name: Apply Changes
@@ -61,7 +61,7 @@ jobs:
6161
run: |
6262
npm run template-oss-apply ${{ steps.flags.outputs.workspace }}
6363
if [[ `git status --porcelain` ]]; then
64-
echo "::set-output name=changes::true"
64+
echo "changes=true" >> $GITHUB_OUTPUT
6565
fi
6666
# This only sets the conventional commit prefix. This workflow can't reliably determine
6767
# what the breaking change is though. If a BREAKING CHANGE message is required then
@@ -71,7 +71,7 @@ jobs:
7171
else
7272
prefix='chore'
7373
fi
74-
echo "::set-output name=message::$prefix: postinstall for dependabot template-oss PR"
74+
echo "message=$prefix: postinstall for dependabot template-oss PR" >> $GITHUB_OUTPUT
7575
7676
# This step will fail if template-oss has made any workflow updates. It is impossible
7777
# for a workflow to update other workflows. In the case it does fail, we continue

.github/workflows/release.yml

Lines changed: 22 additions & 11 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 })
@@ -176,7 +180,7 @@ jobs:
176180
run: |
177181
git commit --all --amend --no-edit || true
178182
git push --force-with-lease
179-
echo "::set-output name=sha::$(git rev-parse HEAD)"
183+
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
180184
- name: Get Workflow Job
181185
uses: actions/github-script@v6
182186
if: steps.commit.outputs.sha
@@ -257,7 +261,7 @@ jobs:
257261
else
258262
result="success"
259263
fi
260-
echo "::set-output name=result::$result"
264+
echo "result=$result" >> $GITHUB_OUTPUT
261265
- name: Conclude Check
262266
uses: LouisBrunner/[email protected]
263267
if: needs.update.outputs.check-id && always()
@@ -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,
@@ -361,15 +368,14 @@ jobs:
361368
- name: Get Needs Result
362369
id: needs-result
363370
run: |
364-
result=""
365371
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
366372
result="x"
367373
elif [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
368374
result="heavy_multiplication_x"
369375
else
370376
result="white_check_mark"
371377
fi
372-
echo "::set-output name=result::$result"
378+
echo "result=$result" >> $GITHUB_OUTPUT
373379
- name: Update Release PR Comment
374380
uses: actions/github-script@v6
375381
env:
@@ -378,15 +384,20 @@ jobs:
378384
with:
379385
script: |
380386
const { PR_NUMBER: issue_number, RESULT } = process.env
381-
const { repo: { owner, repo } } = context
387+
const { runId, repo: { owner, repo } } = context
382388
383389
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'))
390+
const updateComment = comments.find(c =>
391+
c.user.login === 'github-actions[bot]' &&
392+
c.body.startsWith('## Release Workflow\n\n') &&
393+
c.body.includes(runId)
394+
)
385395
386396
if (updateComment) {
387397
console.log('Found comment to update:', JSON.stringify(updateComment, null, 2))
388398
let body = updateComment.body.replace(/Workflow run: :[a-z_]+:/, `Workflow run: :${RESULT}:`)
389-
if (RESULT === 'x') {
399+
const tagCodeowner = RESULT !== 'white_check_mark'
400+
if (tagCodeowner) {
390401
body += `\n\n:rotating_light:`
391402
body += ` @npm/cli-team: The post-release workflow failed for this release.`
392403
body += ` Manual steps may need to be taken after examining the workflow output`

SECURITY.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ GitHub takes the security of our software products and services seriously, inclu
44

55
If you believe you have found a security vulnerability in this GitHub-owned open source repository, you can report it to us in one of two ways.
66

7-
If the vulnerability you have found is *not* [in scope for the GitHub Bug Bounty Program](https://bounty.github.com/#scope) or if you do not wish to be considered for a bounty reward, please report the issue to us directly using [private vulnerability reporting](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability).
7+
If the vulnerability you have found is *not* [in scope for the GitHub Bug Bounty Program](https://bounty.github.com/#scope) or if you do not wish to be considered for a bounty reward, please report the issue to us directly through [[email protected]](mailto:opensource-security@github.com).
88

99
If the vulnerability you have found is [in scope for the GitHub Bug Bounty Program](https://bounty.github.com/#scope) and you would like for your finding to be considered for a bounty reward, please submit the vulnerability to us through [HackerOne](https://hackerone.com/github) in order to be eligible to receive a bounty award.
1010

1111
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
1212

1313
Thanks for helping make GitHub safe for everyone.
14-

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@
4444
},
4545
"templateOSS": {
4646
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
47-
"version": "4.11.3"
47+
"version": "4.12.0"
4848
}
4949
}

0 commit comments

Comments
 (0)