Skip to content

Commit

Permalink
Use github_api in sarif upload script (#128)
Browse files Browse the repository at this point in the history
* Use `github_api` in sarif upload script

* Use the correct path for `github_api` execution

* Use `Bearer` for auth header in `github_api`

#128 (comment)

* Update changelog
  • Loading branch information
wzieba authored Sep 19, 2024
1 parent c4e9a60 commit 9471987
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ _None._

### Bug Fixes

- Fix not working SARIF upload on non-PR branches [#124]
- Fix logic in our `github_api` helper to auto-detecting the GitHub host [#127]
- Fix not working SARIF upload on non-PR branches [#124] [#128]
- Fix logic in our `github_api` helper to auto-detecting the GitHub host [#127] [#128]

### Internal Changes

Expand Down
2 changes: 1 addition & 1 deletion bin/github_api
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ else
url="https://${github_host}/api/v3/$github_endpoint"
fi

curl -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github+json" -s "$@" "$url"
curl -H "Authorization: Bearer ${GITHUB_TOKEN}" -H "Accept: application/vnd.github+json" -s "$@" "$url"
exit $?
8 changes: 1 addition & 7 deletions bin/upload_sarif_to_github
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,4 @@ fi
sarif_json_temp_file=$(mktemp)
echo "$json" > "$sarif_json_temp_file"

curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
--data-binary "@$sarif_json_temp_file" \
https://api.github.com/repos/"$slug"/code-scanning/sarifs
github_api "repos/$slug/code-scanning/sarifs" --data-binary "@$sarif_json_temp_file"

0 comments on commit 9471987

Please sign in to comment.