Compare commits

..
Author SHA1 Message Date
Jon Janego 07d3c7257a Update CONTRIBUTING.md
minor wording
2024-07-12 15:58:13 -05:00
Justin Holguín a2dda6f539 Merge pull request #766 from louis-bompart/main
fix: getRefs function to handle merge_group events
2024-07-12 12:55:37 -07:00
Louis Bompart 45dc50cabe fix: getRefs function to handle merge_group events 2024-07-12 14:22:20 +02:00
Justin Holguín 5a2ce3f5b9 Merge pull request #791 from actions/juxtin/update-version
Prepare even more for v4.3.4
2024-07-11 13:47:10 -07:00
Justin Holguín ac6a6adece Prepare even more for v4.3.4 2024-07-11 20:39:43 +00:00
Justin Holguín 3e2b91798f Merge pull request #790 from actions/juxtin/update-version
Prepare for v4.3.4 release
2024-07-11 13:38:12 -07:00
Justin Holguín d9ab9c8c45 Update version in package.json 2024-07-11 18:57:29 +00:00
Justin Holguín 8c152c7a0f Merge pull request #769 from actions/dependabot/npm_and_yarn/zod-3.23.8
Bump zod from 3.22.4 to 3.23.8
2024-07-10 10:50:09 -07:00
Justin Holguín 0085d30a6f Update dist 2024-07-10 17:47:42 +00:00
dependabot[bot] 08b5bf2921 Bump zod from 3.22.4 to 3.23.8
Bumps [zod](https://github.com/colinhacks/zod) from 3.22.4 to 3.23.8.
- [Release notes](https://github.com/colinhacks/zod/releases)
- [Changelog](https://github.com/colinhacks/zod/blob/master/CHANGELOG.md)
- [Commits](https://github.com/colinhacks/zod/compare/v3.22.4...v3.23.8)

---
updated-dependencies:
- dependency-name: zod
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
2024-07-10 17:43:18 +00:00
Justin Holguín 986fce9040 Merge pull request #784 from actions/dependabot/npm_and_yarn/got-14.4.1
Bump got from 14.2.0 to 14.4.1
2024-07-10 10:41:24 -07:00
Justin Holguín 28743f8570 Merge pull request #719 from actions/change-spdx-parser
Update SPDX Expression Parsing
2024-07-10 10:06:31 -07:00
Justin Holguín d6f34c3a26 Merge pull request #789 from actions/dependabot/npm_and_yarn/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3
2024-07-08 14:53:16 -07:00
dependabot[bot] 465867cec8 Bump braces from 3.0.2 to 3.0.3
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2024-07-08 21:49:13 +00:00
Justin Holguín b4ae47ca2c Properly display test failures using jest 2024-06-10 23:07:07 +00:00
Eli Reisman d85edeb45d remove redundant declaration from TS types module registration 2024-06-10 10:11:00 -07:00
Eli Reisman f60d59372e npm run package 2024-06-10 09:52:17 -07:00
Eli Reisman ed624dba72 more SPDX unit tests to illustrate matching behavior 2024-06-10 09:51:01 -07:00
Eli Reisman bbed6f340a update licenses pkg and tests 2024-06-10 09:51:01 -07:00
Eli Reisman 2e4eaa490e complete test suite conversions; simplify fn name 2024-06-10 09:51:00 -07:00
Eli Reisman ecd706f525 register spdx lib as ES Module, start converting call sites to use new spdx pkg - TODO: update tests 2024-06-10 09:51:00 -07:00
Eli Reisman bc5b235cf6 move jest to dev dependencies 2024-06-10 09:51:00 -07:00
Eli Reisman 154c1500f3 add @onebeyond/spdx-license-satisfies to DR Action project 2024-06-10 09:51:00 -07:00
dependabot[bot] 2115d9eeea Bump got from 14.2.0 to 14.4.1
Bumps [got](https://github.com/sindresorhus/got) from 14.2.0 to 14.4.1.
- [Release notes](https://github.com/sindresorhus/got/releases)
- [Commits](https://github.com/sindresorhus/got/compare/v14.2.0...v14.4.1)

---
updated-dependencies:
- dependency-name: got
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
2024-06-10 01:18:26 +00:00
Eli Reisman df5d74f5d3 Merge pull request #783 from actions/elireisman/all-changes-to-scorecard
Include all added dependencies in scorecard entries
2024-06-07 14:15:00 -07:00
Eli Reisman 1e5b2e69a2 npm run package 2024-06-07 10:00:47 -07:00
Eli Reisman e69288dbec only filter out removed changes from the original PR diff when adding scorecard entries in DR Action report 2024-06-07 10:00:37 -07:00
Eli Reisman 8285e75fb2 Merge pull request #782 from actions/dependabot/npm_and_yarn/undici-5.28.4
Bump undici from 5.28.3 to 5.28.4
2024-06-07 09:44:10 -07:00
Eli Reisman 2224c7c05a npm run package to update dist 2024-06-07 09:35:26 -07:00
dependabot[bot] c0630c2a88 Bump undici from 5.28.3 to 5.28.4
Bumps [undici](https://github.com/nodejs/undici) from 5.28.3 to 5.28.4.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.3...v5.28.4)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2024-06-06 18:28:02 +00:00
10 changed files with 714 additions and 200 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ If you've encountered a problem, please let us know by [submitting an issue](htt
## Enhancements and feature requests ## Enhancements and feature requests
If you've got an idea for a new feature, please submit as [an issue](https://github.com/actions/dependency-review-action/issues/new) so that the community can see it, and we can discuss it there. We may not be able to respond to every single issue, but will make a best effort! If you've got an idea for a new feature or a significant change to the code or its dependencies, please submit as [an issue](https://github.com/actions/dependency-review-action/issues/new) so that the community can see it, and we can discuss it there. We may not be able to respond to every single issue, but will make a best effort!
If you'd like to make a contribution yourself, we ask that before significant effort is put into code changes, that we have agreement that the change aligns with our strategy for the action. Since this is a verified Action owned by GitHub we want to make sure that contributions are high quality, and that they maintain consistency with the rest of the action's behavior. If you'd like to make a contribution yourself, we ask that before significant effort is put into code changes, that we have agreement that the change aligns with our strategy for the action. Since this is a verified Action owned by GitHub we want to make sure that contributions are high quality, and that they maintain consistency with the rest of the action's behavior.
+45
View File
@@ -124,6 +124,51 @@ test('it raises an error when no refs are provided and the event is not a pull r
).toThrow() ).toThrow()
}) })
const pullRequestLikeEvents = [
'pull_request',
'pull_request_target',
'merge_group'
]
test.each(pullRequestLikeEvents)(
'it uses the given refs even when the event is %s',
async eventName => {
setInput('base-ref', 'a-custom-base-ref')
setInput('head-ref', 'a-custom-head-ref')
const refs = getRefs(await readConfig(), {
payload: {
pull_request: {
number: 42,
base: {sha: 'pr-base-ref'},
head: {sha: 'pr-head-ref'}
}
},
eventName
})
expect(refs.base).toEqual('a-custom-base-ref')
expect(refs.head).toEqual('a-custom-head-ref')
}
)
test.each(pullRequestLikeEvents)(
'it uses the event refs when the event is %s and the no refs are input',
async eventName => {
const refs = getRefs(await readConfig(), {
payload: {
pull_request: {
number: 42,
base: {sha: 'pr-base-ref'},
head: {sha: 'pr-head-ref'}
}
},
eventName
})
expect(refs.base).toEqual('pr-base-ref')
expect(refs.head).toEqual('pr-head-ref')
}
)
test('it defaults to runtime scope', async () => { test('it defaults to runtime scope', async () => {
const config = await readConfig() const config = await readConfig()
expect(config.fail_on_scopes).toEqual(['runtime']) expect(config.fail_on_scopes).toEqual(['runtime'])
+21 -31
View File
@@ -1,7 +1,7 @@
import {expect, test} from '@jest/globals' import {expect, test, describe} from '@jest/globals'
import * as spdx from '../src/spdx' import * as spdx from '../src/spdx'
test('satisfiesAny', () => { describe('satisfiesAny', () => {
const units = [ const units = [
{ {
candidate: 'MIT', candidate: 'MIT',
@@ -59,17 +59,14 @@ test('satisfiesAny', () => {
] ]
for (const unit of units) { for (const unit of units) {
let got: boolean = spdx.satisfiesAny(unit.candidate, unit.licenses) const got: boolean = spdx.satisfiesAny(unit.candidate, unit.licenses)
if (got != unit.expected) { test(`should return ${unit.expected} for ("${unit.candidate}", "${unit.licenses}")`, () => {
console.log( expect(got).toBe(unit.expected)
`failing unit test inputs: candidate(${unit.candidate}) licenses(${unit.licenses})` })
)
}
expect(got).toBe(unit.expected)
} }
}) })
test('satisfiesAll', () => { describe('satisfiesAll', () => {
const units = [ const units = [
{ {
candidate: 'MIT', candidate: 'MIT',
@@ -137,17 +134,14 @@ test('satisfiesAll', () => {
] ]
for (const unit of units) { for (const unit of units) {
let got: boolean = spdx.satisfiesAll(unit.candidate, unit.licenses) const got: boolean = spdx.satisfiesAll(unit.candidate, unit.licenses)
if (got != unit.expected) { test(`should return ${unit.expected} for ("${unit.candidate}", "${unit.licenses}")`, () => {
console.log( expect(got).toBe(unit.expected)
`failing unit test inputs: candidate(${unit.candidate}) licenses(${unit.licenses})` })
)
}
expect(got).toBe(unit.expected)
} }
}) })
test('satisfies', () => { describe('satisfies', () => {
const units = [ const units = [
{ {
candidate: 'MIT', candidate: 'MIT',
@@ -220,17 +214,14 @@ test('satisfies', () => {
] ]
for (const unit of units) { for (const unit of units) {
let got: boolean = spdx.satisfies(unit.candidate, unit.constraint) const got: boolean = spdx.satisfies(unit.candidate, unit.constraint)
if (got != unit.expected) { test(`should return ${unit.expected} for ("${unit.candidate}", "${unit.constraint}")`, () => {
console.log( expect(got).toBe(unit.expected)
`failing unit test inputs: candidateExpr(${unit.candidate}) constraintExpr(${unit.constraint})` })
)
}
expect(got).toBe(unit.expected)
} }
}) })
test('isValid', () => { describe('isValid', () => {
const units = [ const units = [
{ {
candidate: 'MIT', candidate: 'MIT',
@@ -258,10 +249,9 @@ test('isValid', () => {
} }
] ]
for (const unit of units) { for (const unit of units) {
let got: boolean = spdx.isValid(unit.candidate) const got: boolean = spdx.isValid(unit.candidate)
if (got != unit.expected) { test(`should return ${unit.expected} for ("${unit.candidate}")`, () => {
console.log(`failing unit test inputs: candidateExpr(${unit.candidate})`) expect(got).toBe(unit.expected)
} })
expect(got).toBe(unit.expected)
} }
}) })
Generated Vendored
+543 -119
View File
File diff suppressed because it is too large Load Diff
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+80 -37
View File
@@ -1,12 +1,12 @@
{ {
"name": "dependency-review-action", "name": "dependency-review-action",
"version": "4.3.3", "version": "4.3.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "dependency-review-action", "name": "dependency-review-action",
"version": "4.3.3", "version": "4.3.4",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.10.1", "@actions/core": "^1.10.1",
@@ -15,14 +15,14 @@
"@octokit/request-error": "^5.0.1", "@octokit/request-error": "^5.0.1",
"@onebeyond/spdx-license-satisfies": "^1.0.1", "@onebeyond/spdx-license-satisfies": "^1.0.1",
"ansi-styles": "^6.2.1", "ansi-styles": "^6.2.1",
"got": "^14.2.0", "got": "^14.4.1",
"jest": "^29.7.0", "jest": "^29.7.0",
"octokit": "^3.1.2", "octokit": "^3.1.2",
"spdx-expression-parse": "^3.0.1", "spdx-expression-parse": "^3.0.1",
"spdx-satisfies": "^5.0.1", "spdx-satisfies": "^5.0.1",
"ts-jest": "^29.1.2", "ts-jest": "^29.1.2",
"yaml": "^2.3.4", "yaml": "^2.3.4",
"zod": "^3.22.3" "zod": "^3.23.8"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
@@ -1945,15 +1945,20 @@
"url": "https://opencollective.com/unts" "url": "https://opencollective.com/unts"
} }
}, },
"node_modules/@sec-ant/readable-stream": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz",
"integrity": "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg=="
},
"node_modules/@sinclair/typebox": { "node_modules/@sinclair/typebox": {
"version": "0.27.8", "version": "0.27.8",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
"integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==" "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA=="
}, },
"node_modules/@sindresorhus/is": { "node_modules/@sindresorhus/is": {
"version": "6.1.0", "version": "6.3.1",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-6.1.0.tgz", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-6.3.1.tgz",
"integrity": "sha512-BuvU07zq3tQ/2SIgBsEuxKYDyDjC0n7Zir52bpHy2xnBbW81+po43aLFPLbeV3HRAheFbGud1qgcqSYfhtHMAg==", "integrity": "sha512-FX4MfcifwJyFOI2lPoX7PQxCqx8BG1HCho7WdiXwpEQx1Ycij0JxkfYtGK7yqNScrZGSlt6RE6sw8QYoH7eKnQ==",
"engines": { "engines": {
"node": ">=16" "node": ">=16"
}, },
@@ -2811,11 +2816,11 @@
} }
}, },
"node_modules/braces": { "node_modules/braces": {
"version": "3.0.2", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dependencies": { "dependencies": {
"fill-range": "^7.0.1" "fill-range": "^7.1.1"
}, },
"engines": { "engines": {
"node": ">=8" "node": ">=8"
@@ -2895,20 +2900,46 @@
} }
}, },
"node_modules/cacheable-request": { "node_modules/cacheable-request": {
"version": "10.2.14", "version": "12.0.1",
"resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.14.tgz", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-12.0.1.tgz",
"integrity": "sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ==", "integrity": "sha512-Yo9wGIQUaAfIbk+qY0X4cDQgCosecfBe3V9NSyeY4qPC2SAkbCS4Xj79VP8WOzitpJUZKc/wsRCYF5ariDIwkg==",
"dependencies": { "dependencies": {
"@types/http-cache-semantics": "^4.0.2", "@types/http-cache-semantics": "^4.0.4",
"get-stream": "^6.0.1", "get-stream": "^9.0.1",
"http-cache-semantics": "^4.1.1", "http-cache-semantics": "^4.1.1",
"keyv": "^4.5.3", "keyv": "^4.5.4",
"mimic-response": "^4.0.0", "mimic-response": "^4.0.0",
"normalize-url": "^8.0.0", "normalize-url": "^8.0.1",
"responselike": "^3.0.0" "responselike": "^3.0.0"
}, },
"engines": { "engines": {
"node": ">=14.16" "node": ">=18"
}
},
"node_modules/cacheable-request/node_modules/get-stream": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-9.0.1.tgz",
"integrity": "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==",
"dependencies": {
"@sec-ant/readable-stream": "^0.4.1",
"is-stream": "^4.0.1"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/cacheable-request/node_modules/is-stream": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-4.0.1.tgz",
"integrity": "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/call-bind": { "node_modules/call-bind": {
@@ -4485,9 +4516,9 @@
} }
}, },
"node_modules/fill-range": { "node_modules/fill-range": {
"version": "7.0.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dependencies": { "dependencies": {
"to-regex-range": "^5.0.1" "to-regex-range": "^5.0.1"
}, },
@@ -4761,21 +4792,22 @@
} }
}, },
"node_modules/got": { "node_modules/got": {
"version": "14.2.0", "version": "14.4.1",
"resolved": "https://registry.npmjs.org/got/-/got-14.2.0.tgz", "resolved": "https://registry.npmjs.org/got/-/got-14.4.1.tgz",
"integrity": "sha512-dBq2KkHcQl3AwPoIWsLsQScCPpUgRulz1qZVthjPYKYOPmYfBnekR3vxecjZbm91Vc3JUGnV9mqFX7B+Fe2quw==", "integrity": "sha512-IvDJbJBUeexX74xNQuMIVgCRRuNOm5wuK+OC3Dc2pnSoh1AOmgc7JVj7WC+cJ4u0aPcO9KZ2frTXcqK4W/5qTQ==",
"dependencies": { "dependencies": {
"@sindresorhus/is": "^6.1.0", "@sindresorhus/is": "^6.3.1",
"@szmarczak/http-timer": "^5.0.1", "@szmarczak/http-timer": "^5.0.1",
"cacheable-lookup": "^7.0.0", "cacheable-lookup": "^7.0.0",
"cacheable-request": "^10.2.14", "cacheable-request": "^12.0.1",
"decompress-response": "^6.0.0", "decompress-response": "^6.0.0",
"form-data-encoder": "^4.0.2", "form-data-encoder": "^4.0.2",
"get-stream": "^8.0.1", "get-stream": "^8.0.1",
"http2-wrapper": "^2.2.1", "http2-wrapper": "^2.2.1",
"lowercase-keys": "^3.0.0", "lowercase-keys": "^3.0.0",
"p-cancelable": "^4.0.1", "p-cancelable": "^4.0.1",
"responselike": "^3.0.0" "responselike": "^3.0.0",
"type-fest": "^4.19.0"
}, },
"engines": { "engines": {
"node": ">=20" "node": ">=20"
@@ -4795,6 +4827,17 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/got/node_modules/type-fest": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.20.0.tgz",
"integrity": "sha512-MBh+PHUHHisjXf4tlx0CFWoMdjx8zCMLJHOjnV1prABYZFHqtFOyauCIK2/7w4oIfwkF8iNhLtnJEfVY2vn3iw==",
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/graceful-fs": { "node_modules/graceful-fs": {
"version": "4.2.11", "version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
@@ -6441,9 +6484,9 @@
} }
}, },
"node_modules/normalize-url": { "node_modules/normalize-url": {
"version": "8.0.0", "version": "8.0.1",
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.0.tgz", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.1.tgz",
"integrity": "sha512-uVFpKhj5MheNBJRTiMZ9pE/7hD1QTeEvugSJW/OmLzAp78PB5O6adfMNTvmfKhXBkvCzC+rqifWcVYpGFwTjnw==", "integrity": "sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w==",
"engines": { "engines": {
"node": ">=14.16" "node": ">=14.16"
}, },
@@ -7859,9 +7902,9 @@
"dev": true "dev": true
}, },
"node_modules/undici": { "node_modules/undici": {
"version": "5.28.3", "version": "5.28.4",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz",
"integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==",
"dependencies": { "dependencies": {
"@fastify/busboy": "^2.0.0" "@fastify/busboy": "^2.0.0"
}, },
@@ -8166,9 +8209,9 @@
} }
}, },
"node_modules/zod": { "node_modules/zod": {
"version": "3.22.4", "version": "3.23.8",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz",
"integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==",
"funding": { "funding": {
"url": "https://github.com/sponsors/colinhacks" "url": "https://github.com/sponsors/colinhacks"
} }
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "dependency-review-action", "name": "dependency-review-action",
"version": "4.3.3", "version": "4.3.4",
"private": true, "private": true,
"description": "A GitHub Action for Dependency Review", "description": "A GitHub Action for Dependency Review",
"main": "lib/main.js", "main": "lib/main.js",
@@ -31,14 +31,14 @@
"@octokit/request-error": "^5.0.1", "@octokit/request-error": "^5.0.1",
"@onebeyond/spdx-license-satisfies": "^1.0.1", "@onebeyond/spdx-license-satisfies": "^1.0.1",
"ansi-styles": "^6.2.1", "ansi-styles": "^6.2.1",
"got": "^14.2.0", "got": "^14.4.1",
"jest": "^29.7.0", "jest": "^29.7.0",
"octokit": "^3.1.2", "octokit": "^3.1.2",
"spdx-expression-parse": "^3.0.1", "spdx-expression-parse": "^3.0.1",
"spdx-satisfies": "^5.0.1", "spdx-satisfies": "^5.0.1",
"ts-jest": "^29.1.2", "ts-jest": "^29.1.2",
"yaml": "^2.3.4", "yaml": "^2.3.4",
"zod": "^3.22.3" "zod": "^3.23.8"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
+5 -4
View File
@@ -11,7 +11,8 @@ export function getRefs(
// The base/head ref from the config take priority, if provided. // The base/head ref from the config take priority, if provided.
if ( if (
context.eventName === 'pull_request' || context.eventName === 'pull_request' ||
context.eventName === 'pull_request_target' context.eventName === 'pull_request_target' ||
context.eventName === 'merge_group'
) { ) {
const pull_request = PullRequestSchema.parse(context.payload.pull_request) const pull_request = PullRequestSchema.parse(context.payload.pull_request)
base_ref = base_ref || pull_request.base.sha base_ref = base_ref || pull_request.base.sha
@@ -22,19 +23,19 @@ export function getRefs(
throw new Error( throw new Error(
'Both a base ref and head ref must be provided, either via the `base_ref`/`head_ref` ' + 'Both a base ref and head ref must be provided, either via the `base_ref`/`head_ref` ' +
'config options, `base-ref`/`head-ref` workflow action options, or by running a ' + 'config options, `base-ref`/`head-ref` workflow action options, or by running a ' +
'`pull_request`/`pull_request_target` workflow.' '`pull_request`/`pull_request_target`/`merge_group` workflow.'
) )
} else if (!base_ref) { } else if (!base_ref) {
throw new Error( throw new Error(
'A base ref must be provided, either via the `base_ref` config option, ' + 'A base ref must be provided, either via the `base_ref` config option, ' +
'`base-ref` workflow action option, or by running a ' + '`base-ref` workflow action option, or by running a ' +
'`pull_request`/`pull_request_target` workflow.' '`pull_request`/`pull_request_target`/`merge_group` workflow.'
) )
} else if (!head_ref) { } else if (!head_ref) {
throw new Error( throw new Error(
'A head ref must be provided, either via the `head_ref` config option, ' + 'A head ref must be provided, either via the `head_ref` config option, ' +
'`head-ref` workflow action option, or by running a ' + '`head-ref` workflow action option, or by running a ' +
'or by running a `pull_request`/`pull_request_target` workflow.' 'or by running a `pull_request`/`pull_request_target`/`merge_group` workflow.'
) )
} }
+15 -2
View File
@@ -125,7 +125,9 @@ async function run(): Promise<void> {
config.deny_groups config.deny_groups
) )
const scorecard = await getScorecardLevels(filteredChanges) // generate informational scorecard entries for all added changes in the PR
const scorecardChanges = getScorecardChanges(changes)
const scorecard = await getScorecardLevels(scorecardChanges)
const minSummary = summary.addSummaryToSummary( const minSummary = summary.addSummaryToSummary(
vulnerableChanges, vulnerableChanges,
@@ -369,7 +371,7 @@ function printScannedDependencies(changes: Changes): void {
} }
function printDeniedDependencies( function printDeniedDependencies(
changes: Change[], changes: Changes,
config: ConfigurationOptions config: ConfigurationOptions
): void { ): void {
core.group('Denied', async () => { core.group('Denied', async () => {
@@ -384,6 +386,17 @@ function printDeniedDependencies(
}) })
} }
function getScorecardChanges(changes: Changes): Changes {
const out: Changes = []
for (const change of changes) {
if (change.change_type === 'added') {
out.push(change)
}
}
return out
}
async function createScorecardWarnings( async function createScorecardWarnings(
scorecards: Scorecard, scorecards: Scorecard,
config: ConfigurationOptions config: ConfigurationOptions
-2
View File
@@ -13,6 +13,4 @@ declare module '@onebeyond/spdx-license-satisfies' {
candidateExpr: string, candidateExpr: string,
licenses: string[] licenses: string[]
): boolean ): boolean
export function isValid(candidateExpr: string): boolean
} }