Skip to content

Commit aa24504

Browse files
committed
Add a "Check compliance" step and related options #12
Signed-off-by: tdruez <[email protected]>
1 parent a1eabe1 commit aa24504

File tree

4 files changed

+50
-9
lines changed

4 files changed

+50
-9
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
on: [push]
2+
3+
jobs:
4+
scan-codebase:
5+
runs-on: ubuntu-22.04
6+
name: Scan codebase with ScanCode.io
7+
steps:
8+
- uses: actions/checkout@v4
9+
with:
10+
path: scancode-inputs
11+
- uses: nexB/scancode-action@alpha
12+
with:
13+
pipelines: "scan_codebase,find_vulnerabilities"
14+
env:
15+
VULNERABLECODE_URL: https://public.vulnerablecode.io/

.github/workflows/scan-codebase.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ on: [push]
22

33
jobs:
44
scan-codebase:
5-
runs-on: ubuntu-22.04
6-
name: Scan codebase with ScanCode.io
5+
runs-on: ubuntu-24.04
6+
name: Scan codebase and check for compliance issues
77
steps:
88
- uses: actions/checkout@v4
99
with:
1010
path: scancode-inputs
1111
- uses: nexB/scancode-action@alpha
1212
with:
13-
pipelines: "scan_codebase,find_vulnerabilities"
14-
env:
15-
VULNERABLECODE_URL: https://public.vulnerablecode.io/
13+
pipelines: "scan_codebase"
14+
check-compliance: true

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ steps:
6767
# Default is 'scancode-outputs'
6868
outputs-archive-name:
6969

70+
# Check for compliance issues in the project.
71+
# Exits with a non-zero status if compliance issues are detected.
72+
# Default is false
73+
check-compliance:
74+
75+
# Failure level for compliance check. Options: ERROR, WARNING, MISSING.
76+
# Default is 'ERROR'
77+
compliance-fail-level:
78+
7079
# Python version that will be installed to run ScanCode.io
7180
# Default is '3.11'
7281
python-version:
@@ -79,6 +88,8 @@ Workflows examples.
7988
8089
### Scan repo codebase
8190
91+
TODO: Why, file only!
92+
8293
```yaml
8394
steps:
8495
- uses: actions/checkout@v4

action.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,25 @@ inputs:
1111
description: "Relative path within the $GITHUB_WORKSPACE for pipeline inputs"
1212
default: "${{ github.workspace }}/scancode-inputs"
1313
input-urls:
14-
description: 'Provide one or more URLs to download for the pipeline run execution'
14+
description: "Provide one or more URLs to download for the pipeline run execution."
1515
required: false
1616
default: ""
1717
project-name:
18-
description: "Name of the project"
18+
description: "Name of the project."
1919
default: "scancode-action"
2020
outputs-archive-name:
21-
description: "Name of the outputs archive"
21+
description: "Name of the outputs archive."
2222
default: "scancode-outputs"
23+
check-compliance:
24+
description: |
25+
Check for compliance issues in the project.
26+
Exits with a non-zero status if compliance issues are detected.
27+
compliance-fail-level:
28+
description: "Failure level for compliance check. Options: ERROR, WARNING, MISSING."
29+
default: "ERROR"
30+
required: false
2331
python-version:
24-
description: "Python version"
32+
description: "Python version."
2533
default: "3.11"
2634

2735
runs:
@@ -107,6 +115,14 @@ runs:
107115
--format ${{ inputs.output-formats }}
108116
--no-color
109117

118+
- name: Check compliance
119+
if: inputs.check-compliance == 'true'
120+
shell: bash
121+
run: scanpipe check-compliance
122+
--project ${{ inputs.project-name }}
123+
--fail-level ${{ inputs.compliance-fail-level }}
124+
--no-color
125+
110126
- name: Upload outputs
111127
uses: actions/upload-artifact@v4
112128
id: artifact-upload-step

0 commit comments

Comments
 (0)