|
1 | | -# scancode-action |
2 | | -Run ScanCode scan in your workflow |
| 1 | +# `@nexB/scancode-action` |
| 2 | + |
| 3 | +Run [ScanCode.io](https://github.com/nexB/scancode.io) pipelines from your Workflows. |
| 4 | + |
| 5 | +> [!IMPORTANT] |
| 6 | +> The scancode-action is currently in the **alpha stage**, and we invite you to |
| 7 | +> contribute to its improvement. Please feel free to submit bug reports or share |
| 8 | +> your ideas by creating new entries in the "Issues" section. |
| 9 | +> Your collaboration helps us enhance the action and ensures a more stable and |
| 10 | +> effective tool for the community. |
| 11 | +> Thank you for your support! |
| 12 | +
|
| 13 | +- [Usage](#usage) |
| 14 | + - [Basic](#basic) |
| 15 | + - [Inputs](#inputs) |
| 16 | +- [Examples](#examples) |
| 17 | + - [Scan repo codebase](#scan-repo-codebase) |
| 18 | + - [Run a specific pipeline](#run-a-specific-pipeline) |
| 19 | + - [Run multiple pipelines](#run-multiple-pipelines) |
| 20 | + - [Choose the output formats](#choose-the-output-formats) |
| 21 | + - [Fetch pipelines inputs](#fetch-pipelines-inputs) |
| 22 | + - [Define a custom project name](#define-a-custom-project-name) |
| 23 | +- [Where does the scan results go?](#where-does-the-scan-results-go) |
| 24 | + |
| 25 | +## Usage |
| 26 | + |
| 27 | +### Basic |
| 28 | + |
| 29 | +```yaml |
| 30 | +steps: |
| 31 | +- uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + path: scancode-inputs |
| 34 | +- uses: nexB/scancode-action@alpha |
| 35 | + with: |
| 36 | + pipelines: "scan_codebase" |
| 37 | + output-formats: "json xlsx spdx cyclonedx" |
| 38 | +``` |
| 39 | +
|
| 40 | +### Inputs |
| 41 | +
|
| 42 | +```yaml |
| 43 | +- uses: nexB/scancode-action@alpha |
| 44 | + with: |
| 45 | + # Names of the pipelines (comma-separated) and in order. |
| 46 | + # Default is 'scan_codebase' |
| 47 | + pipelines: |
| 48 | + |
| 49 | + # The list of output formats to generate. |
| 50 | + # Default is 'json xlsx spdx cyclonedx' |
| 51 | + output-formats: |
| 52 | + |
| 53 | + # Relative path within the $GITHUB_WORKSPACE for pipeline inputs. |
| 54 | + # Default is 'scancode-inputs' |
| 55 | + inputs-path: |
| 56 | + |
| 57 | + # Name of the project. |
| 58 | + # Default is 'scancode-action' |
| 59 | + project-name: |
| 60 | + |
| 61 | + # Python version that will be installed to run ScanCode.io |
| 62 | + # Default is '3.11' |
| 63 | + python-version: |
| 64 | +``` |
| 65 | +
|
| 66 | +## Examples |
| 67 | +
|
| 68 | +### Scan repo codebase |
| 69 | +
|
| 70 | +```yaml |
| 71 | +steps: |
| 72 | +- uses: actions/checkout@v4 |
| 73 | + with: |
| 74 | + path: scancode-inputs |
| 75 | +- uses: nexB/scancode-action@alpha |
| 76 | +``` |
| 77 | +
|
| 78 | +### Run a specific pipeline |
| 79 | +
|
| 80 | +[Built-in pipelines list](https://scancodeio.readthedocs.io/en/latest/built-in-pipelines.html) |
| 81 | +
|
| 82 | +```yaml |
| 83 | +- uses: nexB/scancode-action@alpha |
| 84 | + with: |
| 85 | + pipelines: "scan_codebase" |
| 86 | +``` |
| 87 | +
|
| 88 | +### Run multiple pipelines |
| 89 | +
|
| 90 | +```yaml |
| 91 | +- uses: nexB/scancode-action@alpha |
| 92 | + with: |
| 93 | + pipelines: "scan_codebase,find_vulnerabilities" |
| 94 | + env: |
| 95 | + VULNERABLECODE_URL: https://public.vulnerablecode.io/ |
| 96 | +``` |
| 97 | +
|
| 98 | +#### Configuring `find_vulnerabilities` Pipeline |
| 99 | + |
| 100 | +The `find_vulnerabilities` pipeline requires access to a VulnerableCode instance, |
| 101 | +which can be defined using the `VULNERABLECODE_URL` environment variable. |
| 102 | + |
| 103 | +In the example provided, a public instance is referenced. |
| 104 | +However, you also have the option to run your own VulnerableCode instance. |
| 105 | +For details on setting up and configuring your own instance, please refer to the |
| 106 | +[VulnerableCode documentation](https://vulnerablecode.readthedocs.io/en/latest/index.html). |
| 107 | + |
| 108 | +### Choose the output formats |
| 109 | + |
| 110 | +```yaml |
| 111 | +- uses: nexB/scancode-action@alpha |
| 112 | + with: |
| 113 | + output-formats: "json xlsx spdx cyclonedx" |
| 114 | +``` |
| 115 | + |
| 116 | +### Fetch pipelines inputs |
| 117 | + |
| 118 | +```yaml |
| 119 | +- name: Download repository archive to scancode-inputs/ directory |
| 120 | + run: | |
| 121 | + wget --directory-prefix=scancode-inputs https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip |
| 122 | +- uses: nexB/scancode-action@alpha |
| 123 | + with: |
| 124 | + pipelines: "scan_single_package" |
| 125 | +``` |
| 126 | + |
| 127 | +### Define a custom project name |
| 128 | + |
| 129 | +```yaml |
| 130 | +- uses: nexB/scancode-action@alpha |
| 131 | + with: |
| 132 | + project-name: "my-project-name" |
| 133 | +``` |
| 134 | + |
| 135 | +## Where are the Scan Results? |
| 136 | + |
| 137 | +Upon completion of the workflow, you can **find the scan results** in the dedicated |
| 138 | +**artifacts section** at the bottom of the workflow summary page. |
| 139 | +Look for a file named `scanpipe-outputs` in that section. |
| 140 | +This file contains the outputs generated by the `scancode-action`. |
0 commit comments