Skip to content

Commit 6e6f837

Browse files
committed
docker-scout: only write result files for file-based formats
1 parent e8a56fa commit 6e6f837

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

.github/actions/docker-scout/action.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ inputs:
1717

1818
outputs:
1919
result-file:
20-
description: 'File output result'
20+
description: 'Path to result file (only if format is not packages)'
2121
value: ${{ steps.run.outputs.result-file }}
2222

2323
runs:
@@ -82,6 +82,10 @@ runs:
8282
8383
// TODO: cache binary
8484
85-
const resultPath = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'docker-scout-action-')), 'result.txt');
86-
core.setOutput('result-file', resultPath);
87-
await exec.exec('docker', ['scout', 'cves', inpImage, '--format', inpFormat, `--output`, resultPath]);
85+
const resultFile = path.join(fs.mkdtempSync(path.join(process.env.RUNNER_TEMP || os.tmpdir(), 'docker-scout-')), 'result.txt');
86+
const args = ['scout', 'cves', inpImage, '--format', inpFormat];
87+
if (inpFormat !== 'packages') {
88+
args.push('--output', resultFile);
89+
core.setOutput('result-file', resultFile);
90+
}
91+
await exec.exec('docker', args);

.github/workflows/.test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ jobs:
233233
format:
234234
- packages
235235
- sarif
236+
- sbom
237+
- spdx
236238
steps:
237239
-
238240
name: Checkout
@@ -251,7 +253,8 @@ jobs:
251253
image: registry://moby/buildkit:master
252254
format: ${{ matrix.format }}
253255
-
254-
name: Print result
256+
name: Check result file
257+
if: ${{ matrix.format != 'packages' }}
255258
run: |
256259
set -x
257260
cat ${{ steps.scout.outputs.result-file }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
image: alpine:latest
111111
-
112112
name: Upload SARIF report
113-
uses: github/codeql-action/upload-sarif@v3
113+
uses: github/codeql-action/upload-sarif@v4
114114
with:
115115
sarif_file: ${{ steps.scout.outputs.result-file }}
116116
```

0 commit comments

Comments
 (0)