Skip to content

Commit 34486f3

Browse files
committed
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.
1 parent 9b155d6 commit 34486f3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

‎__tests__/licenses.test.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,15 @@ describe('GH License API fallback', () => {
338338
expect(mockOctokit.rest.licenses.getForRepo).not.toHaveBeenCalled()
339339
expect(unlicensed.length).toEqual(0)
340340
})
341+
342+
test('it checks namespaces when doing exclusions', async () => {
343+
const {unlicensed} = await getInvalidLicenseChanges([unlicensedChange], {
344+
licenseExclusions: [
345+
'pkg:githubactions/bar-org/actions-repo/.github/workflows/some-action.yml'
346+
]
347+
})
348+
349+
expect(mockOctokit.rest.licenses.getForRepo).not.toHaveBeenCalled()
350+
expect(unlicensed.length).toEqual(1)
351+
})
341352
})

‎src/licenses.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ async function groupChanges(
174174
licenseExclusions.findIndex(
175175
exclusion =>
176176
exclusion.type === changeAsPackageURL.type &&
177+
exclusion.namespace === changeAsPackageURL.namespace &&
177178
exclusion.name === changeAsPackageURL.name
178179
) !== -1
179180
) {

0 commit comments

Comments
 (0)