@npmcli/template-oss 4.11.4 → 4.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,11 +2,10 @@ GitHub takes the security of our software products and services seriously, inclu
2
2
 
3
3
  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.
4
4
 
5
- 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).
5
+ 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 [opensource-security@github.com](mailto:opensource-security@github.com).
6
6
 
7
7
  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.
8
8
 
9
9
  **Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
10
10
 
11
11
  Thanks for helping make GitHub safe for everyone.
12
-
@@ -27,11 +27,11 @@ jobs:
27
27
  run: |
28
28
  dependabot_dir="$\{{ steps.metadata.outputs.directory }}"
29
29
  if [[ "$dependabot_dir" == "/" ]]; then
30
- echo "::set-output name=workspace::-iwr"
30
+ echo "workspace=-iwr" >> $GITHUB_OUTPUT
31
31
  else
32
32
  # strip leading slash from directory so it works as a
33
33
  # a path to the workspace flag
34
- echo "::set-output name=workspace::-w ${dependabot_dir#/}"
34
+ echo "workspace=-w ${dependabot_dir#/}" >> $GITHUB_OUTPUT
35
35
  fi
36
36
 
37
37
  - name: Apply Changes
@@ -40,7 +40,7 @@ jobs:
40
40
  run: |
41
41
  {{ rootNpmPath }} run template-oss-apply $\{{ steps.flags.outputs.workspace }}
42
42
  if [[ `git status --porcelain` ]]; then
43
- echo "::set-output name=changes::true"
43
+ echo "changes=true" >> $GITHUB_OUTPUT
44
44
  fi
45
45
  # This only sets the conventional commit prefix. This workflow can't reliably determine
46
46
  # what the breaking change is though. If a BREAKING CHANGE message is required then
@@ -50,7 +50,7 @@ jobs:
50
50
  else
51
51
  prefix='chore'
52
52
  fi
53
- echo "::set-output name=message::$prefix: postinstall for dependabot template-oss PR"
53
+ echo "message=$prefix: postinstall for dependabot template-oss PR" >> $GITHUB_OUTPUT
54
54
 
55
55
  # This step will fail if template-oss has made any workflow updates. It is impossible
56
56
  # for a workflow to update other workflows. In the case it does fail, we continue
@@ -94,7 +94,7 @@ jobs:
94
94
  run: |
95
95
  git commit --all --amend --no-edit || true
96
96
  git push --force-with-lease
97
- echo "::set-output name=sha::$(git rev-parse HEAD)"
97
+ echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
98
98
  {{> stepChecks jobName="Update - Release" jobCheck=(obj sha="steps.commit.outputs.sha" name="Release" )}}
99
99
  {{> stepChecks jobCheck=(obj id="needs.release.outputs.check-id" )}}
100
100
 
@@ -121,7 +121,7 @@ jobs:
121
121
  else
122
122
  result="success"
123
123
  fi
124
- echo "::set-output name=result::$result"
124
+ echo "result=$result" >> $GITHUB_OUTPUT
125
125
  {{> stepChecks jobCheck=(obj id="needs.update.outputs.check-id" status="steps.needs-result.outputs.result") }}
126
126
 
127
127
  post-release:
@@ -172,7 +172,6 @@ jobs:
172
172
  - name: Get Needs Result
173
173
  id: needs-result
174
174
  run: |
175
- result=""
176
175
  if [[ "$\{{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
177
176
  result="x"
178
177
  elif [[ "$\{{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
@@ -180,7 +179,7 @@ jobs:
180
179
  else
181
180
  result="white_check_mark"
182
181
  fi
183
- echo "::set-output name=result::$result"
182
+ echo "result=$result" >> $GITHUB_OUTPUT
184
183
  - name: Update Release PR Comment
185
184
  uses: actions/github-script@v6
186
185
  env:
@@ -201,7 +200,8 @@ jobs:
201
200
  if (updateComment) {
202
201
  console.log('Found comment to update:', JSON.stringify(updateComment, null, 2))
203
202
  let body = updateComment.body.replace(/Workflow run: :[a-z_]+:/, `Workflow run: :${RESULT}:`)
204
- if (RESULT === 'x') {
203
+ const tagCodeowner = RESULT !== 'white_check_mark'
204
+ if (tagCodeowner) {
205
205
  body += `\n\n:rotating_light:`
206
206
  body += ` {{ codeowner }}: The post-release workflow failed for this release.`
207
207
  body += ` Manual steps may need to be taken after examining the workflow output`
@@ -19,7 +19,7 @@ module.exports = class ChangelogNotes {
19
19
  }
20
20
 
21
21
  // A link to the pull request if the commit has one
22
- const prNumber = commit.pullRequest && commit.pullRequest.number
22
+ const prNumber = commit.pullRequest?.number
23
23
  if (prNumber) {
24
24
  entry.push(link(`#${prNumber}`, this.gh.pull(prNumber)))
25
25
  }
@@ -63,7 +63,16 @@ module.exports = class ChangelogNotes {
63
63
 
64
64
  // Group commits by type
65
65
  for (const commit of commits) {
66
- const { entry, breaking } = this.buildEntry(commit, authorsByCommit[commit.sha])
66
+ // when rebase merging multiple commits with a single PR, only the first commit
67
+ // will have a pr number when coming from release-please. this check will manually
68
+ // lookup commits without a pr number and find one if it exists
69
+ if (!commit.pullRequest?.number) {
70
+ commit.pullRequest = { number: await this.gh.commitPrNumber(commit) }
71
+ }
72
+ const { entry, breaking } = this.buildEntry(
73
+ commit,
74
+ authorsByCommit[commit.sha]
75
+ )
67
76
 
68
77
  // Collect commits by type
69
78
  changelog[commit.type].entries.push(entry)
@@ -45,10 +45,25 @@ module.exports = (gh) => {
45
45
  }
46
46
  }
47
47
 
48
+ const commitPrNumber = async (commit) => {
49
+ try {
50
+ const res = await gh.octokit.rest.repos.listPullRequestsAssociatedWithCommit({
51
+ owner,
52
+ repo,
53
+ commit_sha: commit.sha,
54
+ per_page: 1,
55
+ })
56
+ return res.data[0].number
57
+ } catch {
58
+ return null
59
+ }
60
+ }
61
+
48
62
  const url = (...p) => `https://github.com/${owner}/${repo}/${p.join('/')}`
49
63
 
50
64
  return {
51
65
  authors,
66
+ commitPrNumber,
52
67
  pull: (number) => url('pull', number),
53
68
  commit: (sha) => url('commit', sha),
54
69
  compare: (a, b) => a ? url('compare', `${a.toString()}...${b.toString()}`) : null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/template-oss",
3
- "version": "4.11.4",
3
+ "version": "4.12.0",
4
4
  "description": "templated files used in npm CLI team oss projects",
5
5
  "main": "lib/content/index.js",
6
6
  "bin": {