Skip to content

Commit 3297a29

Browse files
committed
test: add cveId tests
1 parent 43d428b commit 3297a29

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

.github/workflows/test-and-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646
release:
4747
name: Release
4848
needs: test
49+
permissions:
50+
content: write
4951
runs-on: ubuntu-latest
5052
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
5153
steps:

commit-to-output.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ export const formatType = {
3939

4040
function toStringPlaintext (data) {
4141
let s = ''
42+
4243
if (data.cveId) {
43-
const pr = data.pr ? data.prUrl : ''
44-
return ` * ${data.cveId} - ${data.summary.trim()} - ${pr}`
44+
s += `(${data.cveId})`
4545
}
4646

4747
s += (data.semver || []).length ? `(${data.semver.join(', ').toUpperCase()}) ` : ''
@@ -98,11 +98,7 @@ function toStringMarkdown (data) {
9898
}
9999

100100
function toStringMessageOnly (data) {
101-
let cveData
102-
if (data.cveId) {
103-
cveData = `${data.cveId} - `
104-
}
105-
return ` * ${cveData}${data.summary.trim()}`
101+
return ` * ${data.cveId ? '(' + data.cveId + ') ' : ''}${data.summary.trim()}`
106102
}
107103

108104
export function commitToOutput (commit, format, ghId, commitUrl) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@octokit/graphql": "^7.0.1",
2929
"async": "^3.2.4",
3030
"chalk": "^5.3.0",
31-
"commit-stream": "^2.1.0",
31+
"commit-stream": "^2.2.0",
3232
"debug": "^4.3.4",
3333
"ghauth": "^6.0.0",
3434
"ghissues": "^1.1.4",

test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,12 @@ test('test find-matching-prs', (t) => {
142142
`)
143143
t.end()
144144
})
145+
146+
test('test group, CVE-ID', (t) => {
147+
const out = exec('--md --start-ref=43d428b3d2 --end-ref=43d428b3d2 --group --filter-release')
148+
t.equal(
149+
out,
150+
`* \\[[\`43d428b3d2\`](https://github.com/nodejs/changelog-maker/commit/43d428b3d2)] - **(CVE-2024-22020)** **feat**: add cveId support to commmit output (RafaelGSS) [nodejs/node#55819](https://github.com/nodejs/node/pull/55819)
151+
`)
152+
t.end()
153+
})

0 commit comments

Comments
 (0)