File tree Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,19 @@ import type { GhsaDetails } from '../../utils/github.mts'
66
77const GITHUB_ADVISORIES_URL = 'https://github.com/advisories'
88
9+ /**
10+ * Extract unique package names with ecosystems from vulnerability details.
11+ */
12+ function getUniquePackages ( details : GhsaDetails ) : string [ ] {
13+ return [
14+ ...new Set (
15+ details . vulnerabilities . nodes . map (
16+ v => `${ v . package . name } (${ v . package . ecosystem } )` ,
17+ ) ,
18+ ) ,
19+ ]
20+ }
21+
922export type SocketFixBranchParser = (
1023 branch : string ,
1124) => SocketFixBranchParseResult | undefined
@@ -60,13 +73,7 @@ export function getSocketFixPullRequestBody(
6073 if ( ! details ) {
6174 return body
6275 }
63- const packages = [
64- ...new Set (
65- details . vulnerabilities . nodes . map (
66- v => `${ v . package . name } (${ v . package . ecosystem } )` ,
67- ) ,
68- ) ,
69- ]
76+ const packages = getUniquePackages ( details )
7077 return [
7178 body ,
7279 '' ,
@@ -86,13 +93,7 @@ export function getSocketFixPullRequestBody(
8693 const details = ghsaDetails ?. get ( id )
8794 const item = `- [${ id } ](${ GITHUB_ADVISORIES_URL } /${ id } )`
8895 if ( details ) {
89- const packages = [
90- ...new Set (
91- details . vulnerabilities . nodes . map (
92- v => `${ v . package . name } (${ v . package . ecosystem } )` ,
93- ) ,
94- ) ,
95- ]
96+ const packages = getUniquePackages ( details )
9697 return `${ item } - ${ details . summary } (${ joinAnd ( packages ) } )`
9798 }
9899 return item
You can’t perform that action at this time.
0 commit comments