-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathaction.yml
More file actions
83 lines (73 loc) · 2.6 KB
/
Copy pathaction.yml
File metadata and controls
83 lines (73 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: "ScanCode action"
description: "Run ScanCode.io pipelines in your workflows"
inputs:
pipelines:
description: "Names of the pipelines (comma-separated) and in order."
default: "scan_codebase"
output-formats:
description: "Output formats"
default: "json xlsx spdx cyclonedx"
inputs-path:
description: "Relative path within the $GITHUB_WORKSPACE for pipeline inputs"
default: "${{ github.workspace }}/scancode-inputs"
project-name:
description: "Name of the project"
default: "scancode-action"
python-version:
description: "Python version"
default: "3.11"
runs:
using: "composite"
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Set up environment
shell: bash
run: |
echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV
echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV
echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV
- name: Install ScanCode.io
shell: bash
run: |
pip install scancodeio
scanpipe migrate
- name: Generate pipelines CLI arguments
shell: bash
run: |
IFS=',' read -ra PIPELINES <<< "${{ inputs.pipelines }}"
options=""
for pipeline in "${PIPELINES[@]}"; do
options+="--pipeline $pipeline "
done
echo "PIPELINE_CLI_ARGS=${options}" >> $GITHUB_ENV
- name: Create project with ${{ inputs.pipelines }} pipelines
shell: bash
run: |
scanpipe create-project ${{ inputs.project-name }} ${{ env.PIPELINE_CLI_ARGS }}
- name: Set project work directory in the environment
shell: bash
run: |
project_status=$(scanpipe status --project ${{ inputs.project-name }})
work_directory=$(echo "$project_status" | grep -oP 'Work directory:\s*\K[^\n]+')
echo "PROJECT_WORK_DIRECTORY=$work_directory" >> $GITHUB_ENV
- name: Copy input files to project work directory
shell: bash
run: cp -r ${{ inputs.inputs-path }}/* ${{ env.PROJECT_WORK_DIRECTORY }}/input/
- name: Run the pipelines
shell: bash
run: scanpipe execute --project ${{ inputs.project-name }} --no-color
- name: Generate outputs
id: scanpipe
shell: bash
run: scanpipe output
--project ${{ inputs.project-name }}
--format ${{ inputs.output-formats }}
--no-color
- name: Upload outputs
uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: scanpipe-outputs
path: ${{ env.PROJECT_WORK_DIRECTORY }}/output/*