Skip to content

Commit 9471987

Browse files
authored
Use github_api in sarif upload script (#128)
* 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
1 parent c4e9a60 commit 9471987

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ _None._
4242

4343
### Bug Fixes
4444

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

4848
### Internal Changes
4949

bin/github_api

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ else
3636
url="https://${github_host}/api/v3/$github_endpoint"
3737
fi
3838

39-
curl -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github+json" -s "$@" "$url"
39+
curl -H "Authorization: Bearer ${GITHUB_TOKEN}" -H "Accept: application/vnd.github+json" -s "$@" "$url"
4040
exit $?

bin/upload_sarif_to_github

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,4 @@ fi
6262
sarif_json_temp_file=$(mktemp)
6363
echo "$json" > "$sarif_json_temp_file"
6464

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

0 commit comments

Comments
 (0)