Code Issues Pull Requests Actions Packages Projects Releases 15 Wiki Activity Security Code Quality

ci: Enhance scan-vulnerabilities workflow by adding a step to read API key from the runner environment for improved security

This commit is contained in:
tienbh committed 2026-11-20 14:37:53 +07:00
1 parent 1febc3fd72
commit 02d48ef623
1 file changed
+13 -1
@@ -21,11 +21,23 @@ jobs:
output-file: sbom.json
upload-artifact: false
- name: Read API key from the runner
run: |
if [[ -z "${DT_API_KEY:-}" ]]; then
echo "DT_API_KEY is not set on this runner"
exit 1
fi
{
echo "DT_API_KEY<<__DT_API_KEY__"
printf '%s\n' "$DT_API_KEY"
echo "__DT_API_KEY__"
} >> "$GITHUB_ENV"
- name: Upload SBOM to Dependency-Track
uses: DependencyTrack/gh-upload-sbom@v4
with:
server-hostname: "${{ vars.DT_HOSTNAME }}"
api-key: "${{ DT_API_KEY }}"
api-key: ${{ env.DT_API_KEY }}
project-name: "${{ github.repository }}"
project-version: "latest"
bom-filename: "sbom.json"