Skip to content

Commit 5eca819

Browse files
Rodrigo López Datohimynameisdave
andauthored
Add debug mode option (#28)
Co-authored-by: Dave Lunny <[email protected]>
1 parent f61a4c0 commit 5eca819

File tree

7 files changed

+42
-3
lines changed

7 files changed

+42
-3
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,17 @@ jobs:
3030
- name: Build
3131
run: yarn build
3232

33-
- name: Run FOSSA scan and upload build data
33+
- name: Run FOSSA scan in debug mode and upload build data
3434
uses: ./
3535
with:
3636
api-key: ${{secrets.fossaApiKey}}
37+
debug: true
38+
39+
- name: Upload FOSSA debug bundle as a build artifact
40+
uses: actions/upload-artifact@v3
41+
with:
42+
name: fossa.debug.json.gz
43+
path: ./fossa.debug.json.gz
3744

3845
- name: Run FOSSA container scan and upload build data
3946
uses: ./

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,29 @@ jobs:
103103
endpoint: fossa.my-company.com
104104
```
105105

106+
### `debug`
107+
108+
**Optional** If set to `true`, run all FOSSA commands in debug mode. Running `fossa analyze` in debug mode will generate a debug bundle that can be uploaded as a build artifact after this action completes.
109+
110+
One way to upload build artifacts is to use the [`upload-artifact`](https://github.com/actions/upload-artifact) GitHub action. Example:
111+
112+
```yml
113+
jobs:
114+
fossa-scan:
115+
runs-on: ubuntu-latest
116+
steps:
117+
- uses: actions/checkout@v3
118+
- uses: fossas/fossa-action@main
119+
with:
120+
api-key: ${{secrets.fossaApiKey}}
121+
debug: true
122+
- uses: actions/upload-artifact@v3
123+
with:
124+
name: fossa.debug.json.gz
125+
path: ./fossa.debug.json.gz
126+
```
127+
128+
106129
## Examples
107130
We've provided a few examples of how to use FOSSA's Github Action in your own project. These examples use an API key stored as a Github secret environment variable `fossaAPiKey`.
108131

action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ inputs:
2424
Override the detected FOSSA project branch. If running FOSSA analysis on a
2525
Pull Request, as a start you can use the contexts `github.ref` or `github.ref_name`.
2626
required: false
27+
debug:
28+
description: >-
29+
Run all FOSSA commands in debug mode. Running `fossa analyze` in debug
30+
mode will generate a debug bundle that can be uploaded as a build artifact
31+
after this action completes.
32+
default: false
2733

2834
runs:
2935
using: node16

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ export const CONTAINER = getInput('container', getInputOptions());
1212
export const RUN_TESTS = getBooleanInput('run-tests', {required: false});
1313
export const ENDPOINT = getInput('endpoint', getInputOptions());
1414
export const BRANCH = getInput('branch', getInputOptions());
15+
export const DEBUG = getBooleanInput('debug', {required: false});

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
RUN_TESTS,
77
ENDPOINT,
88
BRANCH,
9+
DEBUG,
910
} from './config';
1011
import { fetchFossaCli } from './download-cli';
1112

@@ -26,6 +27,7 @@ export async function analyze(): Promise<void> {
2627
cmd,
2728
...getEndpointArgs(),
2829
...getBranchArgs(),
30+
DEBUG ? '--debug' : null,
2931
].filter(arg => arg);
3032

3133
// Setup listeners

0 commit comments

Comments
 (0)