Check namespaces when excluding license checks

The `allow-dependencies-licenses` option was not checking the namespace
part of the PURL to make sure it matched.
This commit is contained in:
Kevin Dangoor
2025-05-08 17:17:08 -04:00
parent 9b155d6432
commit 34486f306e
2 changed files with 12 additions and 0 deletions
+11
View File
@@ -338,4 +338,15 @@ describe('GH License API fallback', () => {
expect(mockOctokit.rest.licenses.getForRepo).not.toHaveBeenCalled()
expect(unlicensed.length).toEqual(0)
})
test('it checks namespaces when doing exclusions', async () => {
const {unlicensed} = await getInvalidLicenseChanges([unlicensedChange], {
licenseExclusions: [
'pkg:githubactions/bar-org/actions-repo/.github/workflows/some-action.yml'
]
})
expect(mockOctokit.rest.licenses.getForRepo).not.toHaveBeenCalled()
expect(unlicensed.length).toEqual(1)
})
})
+1
View File
@@ -174,6 +174,7 @@ async function groupChanges(
licenseExclusions.findIndex(
exclusion =>
exclusion.type === changeAsPackageURL.type &&
exclusion.namespace === changeAsPackageURL.namespace &&
exclusion.name === changeAsPackageURL.name
) !== -1
) {