Skip to content

Commit 71630b0

Browse files
fix(sbom): use absolute paths for bazel run invocation
bazel run changes working directory before executing the binary, so relative paths to bazel-bin artifacts are not found. Use $GITHUB_WORKSPACE to construct absolute paths for input/output files.
1 parent a004eb7 commit 71630b0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

.github/workflows/generate_sbom.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ jobs:
7878
- name: Convert SPDX to GitHub Dependency snapshot
7979
run: |
8080
bazel run @score_sbom//scripts:spdx_to_github_snapshot_bin -- \
81-
--input bazel-bin/reference_integration_sbom.spdx.json \
82-
--output snapshot.json \
81+
--input "$GITHUB_WORKSPACE/bazel-bin/reference_integration_sbom.spdx.json" \
82+
--output "$GITHUB_WORKSPACE/snapshot.json" \
8383
--sha "${{ github.sha }}" \
8484
--ref "${{ github.ref }}" \
8585
--job-correlator "generate-sbom" \
@@ -90,7 +90,7 @@ jobs:
9090
with:
9191
script: |
9292
const fs = require('fs');
93-
const snapshot = JSON.parse(fs.readFileSync('snapshot.json', 'utf8'));
93+
const snapshot = JSON.parse(fs.readFileSync(process.env.GITHUB_WORKSPACE + '/snapshot.json', 'utf8'));
9494
await github.rest.dependencyGraph.createRepositorySnapshot({
9595
owner: context.repo.owner,
9696
repo: context.repo.repo,

0 commit comments

Comments
 (0)