Skip to content

Commit

Permalink
Update PR Scan workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
circle-aloychan committed Mar 28, 2024
1 parent ab2fe09 commit da6081d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/pr-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ on:
required: false
type: string
default: ubuntu-latest
allow-reciprocal-licenses:
description: |
(Only applicable to private repositories)
Allows licenses classified as 'reciprocal' to be used.
required: false
type: boolean
default: true

jobs:
scan:
Expand Down Expand Up @@ -66,6 +73,7 @@ jobs:
id: config
env:
SEVERITY: ${{ inputs.fail_on_severity }}
ALLOW_RECIPROCAL_LICENSES: ${{ inputs.allow-reciprocal-licenses }}
with:
script: |-
const path = require('path');
Expand All @@ -88,13 +96,14 @@ jobs:
}
const privateRepo = context.payload?.repository?.private || false;
const isReciprocalLicenseAllowed = process.env.ALLOW_RECIPROCAL_LICENSES === 'true';
let licenseCfgFile = path.join(configsDir, 'license.yaml');
try {
const licenseCfg = yaml.load(fs.readFileSync(licenseCfgFile));
const allowedLicensesRaw = [];
allowedLicensesRaw.push(...licenseCfg.license.notice);
if (privateRepo) {
if (privateRepo && isReciprocalLicenseAllowed) {
allowedLicensesRaw.push(...licenseCfg.license.reciprocal);
}
// Filter out non-SPDX licenses
Expand Down

0 comments on commit da6081d

Please sign in to comment.