Skip to content

Commit 1c6b363

Browse files
committed
Updating license scanner to use new version (1.0.2)
1 parent fdb341c commit 1c6b363

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/license_audit.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Audit licenses
2+
on:
3+
pull_request_target:
4+
5+
jobs:
6+
run_scancode_toolkit:
7+
name: Get inventory of licenses used in project
8+
runs-on: ubuntu-latest
9+
container:
10+
image: ghcr.io/oracledevrel/scancode-toolkit:v21.3.31
11+
credentials:
12+
username: ${{ github.actor }}
13+
password: ${{ secrets.GHCR_PAT }}
14+
steps:
15+
- name: 'Checkout repo'
16+
uses: actions/checkout@v2
17+
with:
18+
ref: ${{ github.event.pull_request.head.ref }}
19+
repository: ${{ github.event.pull_request.head.repo.full_name }}
20+
- name: Run Scancode-toolkit
21+
run: |
22+
scancode -l --ignore licenses.json --ignore .github/**/* --ignore license_policy.yml --license-policy license_policy.yml --only-findings --summary --json-pp licenses.json *
23+
echo "\n\nHere is the licenses.json:\n"
24+
echo $(cat licenses.json)
25+
- name: Look for non-approved licenses
26+
uses: oracle-devrel/[email protected]
27+
id: analysis
28+
with:
29+
licenses_file: '/github/workspace/licenses.json'
30+
- name: Analysis results
31+
run: echo "${{ steps.analysis.outputs.unapproved_licenses }}"
32+
- name: Comment if analysis finds unapproved licenses
33+
if: steps.analysis.outputs.unapproved_licenses == 'true'
34+
uses: mshick/add-pr-comment@v1
35+
with:
36+
message: |
37+
:no_entry: **License Inspection**
38+
Requires manual inspection. There are some licenses which dictate further analysis and review.
39+
repo-token: ${{ secrets.GITHUB_TOKEN }}
40+
- name: Halt pipeline on unapproved licenses
41+
if: steps.analysis.outputs.unapproved_licenses == 'true'
42+
run: exit 1

0 commit comments

Comments
 (0)