Run ScanCode.io pipelines directly from your GitHub Workflows.
- What a successful run means
- Usage
- Examples
- Scan repo codebase
- Run a specific pipeline
- Run multiple pipelines
- Specify pipeline options
- Choose the output formats
- Provide download URLs inputs
- Check for compliance issues
- Configure the project
- Define a custom project name
- Use a specific ScanCode.io Docker image
- Install extra packages
- Run source to binary mapping
- Where are the scan results?
The action creates a ScanCode.io project from your inputs, runs the selected
pipelines, and uploads the results as a workflow artifact. The default
scan_codebase pipeline detects the packages, licenses, and copyrights of your code.
A successful run means the pipelines completed, not that your code is compliant. ScanCode.io collects the data without judging it: what is acceptable depends on your own policies. To fail the run on issues:
- Provide license policies and enable
check-compliance, see Check for compliance issues. - Add the
find_vulnerabilitiespipeline and enablecompliance-fail-on-vulnerabilities, see Fail on known vulnerabilities.
The action runs ScanCode.io from its Docker image, on a GitHub-hosted Ubuntu runner,
where Docker, the PostgreSQL service, and sudo are available.
steps:
- uses: actions/checkout@v7
with:
path: scancode-inputs
persist-credentials: false
- uses: aboutcode-org/scancode-action@v1
with:
pipelines: "scan_codebase"
output-formats: "json xlsx spdx cyclonedx"
The action is released with Semantic Versioning, see the releases:
@v1runs the latestv1.x.yrelease, including new features and fixes, without breaking changes.@v1.0.0runs this exact release.@<full commit SHA> # v1.0.0runs this exact commit, the most secure option. Dependabot keeps it up to date.
The alpha, beta, beta2, beta3, and v0.1 tags are deprecated: use @v1.
- uses: aboutcode-org/scancode-action@v1
with:
# Names of the pipelines (comma-separated) and in order.
# Default is 'scan_codebase'
pipelines:
# The list of output formats to generate.
# Default is 'json xlsx spdx cyclonedx'
output-formats:
# Path of the pipeline inputs, within the $GITHUB_WORKSPACE.
# Default is 'scancode-inputs'
inputs-path:
# One or more URLs to download for the pipeline run execution.
# When provided, the inputs-path content is not used.
input-urls:
# Name of the project, unique for each run of the action in a job.
# Default is 'scancode-action'
project-name:
# Name of the outputs archive, followed by the project name.
# Default is 'scancode-outputs'
outputs-archive-name:
# Check for compliance issues in the project.
# Exits with a non-zero status if compliance issues are detected.
# Default is false
check-compliance:
# Failure level for compliance check. Options: ERROR, WARNING, MISSING.
# Default is 'ERROR'
compliance-fail-level:
# Exit with a non-zero status if known vulnerabilities are detected in discovered
# packages and dependencies.
# Default is false
compliance-fail-on-vulnerabilities:
# ScanCode.io Docker image to use.
# Default is the full image of a pinned ScanCode.io release
scancodeio-image:
See the CI workflow for more examples.
steps:
- uses: actions/checkout@v7
with:
path: scancode-inputs
persist-credentials: false
- uses: aboutcode-org/scancode-action@v1
The files and directories starting with a dot at the root of the inputs, such as
.github/, are not copied.
- uses: aboutcode-org/scancode-action@v1
with:
pipelines: "analyze_docker_image"
input-urls: "docker://alpine:3.24.4"
- uses: aboutcode-org/scancode-action@v1
with:
pipelines: "scan_codebase,find_vulnerabilities"
env:
VULNERABLECODE_URL: https://public.vulnerablecode.io/
The find_vulnerabilities pipeline requires access to a VulnerableCode instance,
which can be defined using the VULNERABLECODE_URL environment variable.
If the instance requires an API key, provide it from a secret with the
VULNERABLECODE_API_KEY environment variable.
In the example provided, a public instance is referenced. However, you also have the option to run your own VulnerableCode instance. For details on setting up and configuring your own instance, please refer to the VulnerableCode documentation.
When enabled, the workflow will fail if any known vulnerabilities are found in the
project's discovered packages or dependencies.
Activate this behavior by enabling check-compliance and setting
compliance-fail-on-vulnerabilities to true.
- uses: aboutcode-org/scancode-action@v1
with:
pipelines: "scan_codebase,find_vulnerabilities"
check-compliance: true
compliance-fail-on-vulnerabilities: true
env:
VULNERABLECODE_URL: https://public.vulnerablecode.io/
Use the pipeline_name:option1,option2 syntax to select optional steps for the
map_deploy_to_develop pipeline. The option names are case-sensitive.
- uses: aboutcode-org/scancode-action@v1
with:
pipelines: "map_deploy_to_develop:Java,JavaScript"
The supported formats are json, csv, xlsx, attribution (HTML notice),
spdx, cyclonedx, and ort-package-list. The xlsx spreadsheet is the easiest
to review by hand.
- uses: aboutcode-org/scancode-action@v1
with:
output-formats: "json xlsx spdx cyclonedx"
Note
To specify a CycloneDX spec version (default to latest), use the syntax
cyclonedx:VERSION as format value. For example: cyclonedx:1.5.
- uses: aboutcode-org/scancode-action@v1
with:
pipelines: "map_deploy_to_develop"
input-urls:
https://domain.url/source.zip#from
https://domain.url/binaries.zip#to
For example, to scan the archive of your repository as a package:
- uses: aboutcode-org/scancode-action@v1
with:
pipelines: "scan_single_package"
input-urls: "https://github.com/${{ github.repository }}/archive/${{ github.ref }}.zip"
The supported URL schemes are http://, https://, docker://, and pkg:
(Package URL). Other URLs are skipped with a warning.
- uses: aboutcode-org/scancode-action@v1
with:
check-compliance: true
compliance-fail-level: "WARNING"
The license policies are read from a policies.yml file at the root of the
inputs-path directory: the root of your repository in the Basic example.
See the ScanCode.io Policies documentation
for the file format.
Important
Without a policies.yml file, there is nothing to check and the run succeeds.
The file is not used with input-urls, as the inputs-path content is not copied.
The compliance-fail-level sets the compliance alerts that fail the run:
ERROR:erroralerts.WARNING:errorandwarningalerts.MISSING:errorandwarningalerts, and licenses missing from the policies.
The project settings, such as the product name and version, or the patterns of the
files to ignore, are read from a scancode-config.yml file at the root of the
inputs-path directory. See the
ScanCode.io project configuration documentation
for the file format. Like policies.yml, the file is not used with input-urls.
- uses: aboutcode-org/scancode-action@v1
with:
project-name: "my-project-name"
Each run of the action in a job requires its own project name. The scanpipe
command remains available in the next steps of the job.
The action runs ScanCode.io from a pre-built Docker image. By default, it uses the full image of a pinned release, but you can point it to another image or tag, for example to always run the latest release:
- uses: aboutcode-org/scancode-action@v1
with:
scancodeio-image: "ghcr.io/aboutcode-org/scancode.io:latest-full"
To run pipelines or tools that are not included in the ScanCode.io image, build your
own image on top of it in a previous step, and provide it as scancodeio-image.
For example, to install the minecode-pipelines Python package:
- name: Build a ScanCode.io image with extra packages
shell: bash
run: |
docker build --tag scancodeio-extra-packages - << 'EOF'
FROM ghcr.io/aboutcode-org/scancode.io:v38.4.0-full
COPY --from=ghcr.io/astral-sh/uv:0.13.12 /uv /usr/local/bin/uv
RUN uv pip install --no-cache --python /opt/scancodeio/.venv/bin/python minecode-pipelines==1.0.1
EOF
- uses: aboutcode-org/scancode-action@v1
with:
scancodeio-image: "scancodeio-extra-packages"
pipelines: "mine_pypi"
env:
FEDERATEDCODE_GIT_ACCOUNT_URL: ${{ vars.FEDERATEDCODE_GIT_ACCOUNT_URL }}
FEDERATEDCODE_GIT_SERVICE_TOKEN: ${{ secrets.FEDERATEDCODE_GIT_SERVICE_TOKEN }}
FEDERATEDCODE_GIT_SERVICE_NAME: ${{ vars.FEDERATEDCODE_GIT_SERVICE_NAME }}
FEDERATEDCODE_GIT_SERVICE_EMAIL: ${{ vars.FEDERATEDCODE_GIT_SERVICE_EMAIL }}
The mine_* pipelines push their results to FederatedCode Git repositories, and
require the FEDERATEDCODE_GIT_* environment variables, see the
FederatedCode settings.
Warning
The installed packages run with access to the workspace, the network, and the environment variables provided to the action. Install trusted packages only, and pin their versions.
Use the workflow template to validate the integrity of a binary: it maps the compiled binary to its source code, which helps to spot malicious, unexpected, or otherwise undesirable code in the binary.
-
In your workflow, add a job that builds the binary and uploads it as an artifact.
-
Add a second job that runs the template:
map-source-binary: needs: build # Job id from step 1 uses: aboutcode-org/scancode-action/.github/workflows/map-deploy-to-develop-template.yml@v1 with: artifact-name: binaries # Name of the artifact uploaded in step 1 steps: "Python,Java" # Optional steps, case-sensitive
The steps are the optional steps of the
map_deploy_to_develop
pipeline. The repository and ref inputs select the source code to compare with,
the repository of the workflow by default.
See the map-source-binary-boolean-py job of the CI workflow
for an example on a Python project.
Upon completion of the workflow, you can find the scan results in the dedicated
artifacts section at the bottom of the workflow summary page.
Look for a file named <outputs-archive-name>-<project-name>, which is
scancode-outputs-scancode-action with the default inputs.
This file contains the outputs generated by the scancode-action.