File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -47,12 +47,22 @@ download_sbom() {
4747
4848 # GitHub API URL for file content
4949 local api_url=" https://api.github.com/repos/$repo /dependency-graph/sbom"
50+
51+ # Determine which token to use
52+ local auth_header=" "
53+ if [[ -n " ${GITHUB_TOKEN:- } " ]]; then
54+ auth_header=" Authorization: Bearer $GITHUB_TOKEN "
55+ elif [[ -n " ${GHAPP_TOKEN:- } " ]]; then
56+ auth_header=" Authorization: Bearer $GHAPP_TOKEN "
57+ else
58+ log_error " No valid GitHub token found. Set GITHUB_TOKEN or GHAPP_TOKEN."
59+ exit 1
60+ fi
5061
51- # Download file metadata to get download URL
52- local response
62+ # Download SBOM file
5363 if curl -L \
5464 -H " Accept: application/vnd.github+json" \
55- -H " Authorization: Bearer $GITHUB_TOKEN " \
65+ -H " $auth_header " \
5666 -H " X-GitHub-Api-Version: 2022-11-28" \
5767 " $api_url " \
5868 -o " $output_file " ; then
You can’t perform that action at this time.
0 commit comments