Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support to cveId #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions commit-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export default function commitStream (ghUser, ghProject) {
commit.reviewers = []
}
commit.reviewers.push({ name: m[1], email: m[2] })
} else if ((m = line.match(/\bCVE-ID:\s+(CVE-\d{4}-\d{5})\b/)) !== null) {
commit.cveId = m[1];
} else if ((m = line.match(/^\s+PR(?:[- ]?URL)?:?\s*(.+)\s*$/) || line.match(/\(#(\d+)\)$/)) !== null) {
commit.prUrl = m[1]
if (
Expand Down
19 changes: 19 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,22 @@ test('current commit log with ghUser and ghRepo passed', function (t) {
}, 'got correct pr url for green-button merge')
})
})

test('cve id', function (t) {
gitToList(t, 'git log', 'rvagg', 'commit-stream', function (err, list) {
t.error(err, 'no error')

t.ok(list && list.length > 1, 'got a list')

t.deepEqual(list[list.length - 30], {
sha: 'de55c4c81dfb6cf13e5e2ae24ae88c9be4f5b598',
authors: [
{ name: 'RafaelGSS', email: '[email protected]' }
],
authorDate: 'Fri Nov 22 00:19:29 2024 -0300',
author: { name: 'RafaelGSS', email: '[email protected]' },
summary: 'feat: add cveId support',
cveId: 'CVE-2024-12345'
}, 'got correct pr url for green-button merge')
})
})
Loading