Skip to content

Commit

Permalink
Fix logic of github_api to autodetect host (#127)
Browse files Browse the repository at this point in the history
* Fix logic of github_api to autodetect host

* Add CHANGELOG entry
  • Loading branch information
AliSoftware authored Sep 19, 2024
1 parent ed6ecaa commit c4e9a60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ _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]

### Internal Changes

Expand Down
6 changes: 3 additions & 3 deletions bin/github_api
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# ENVIRONMENT VARIABLES:
# GITHUB_TOKEN: Required. The GitHub token to use for authentication.
# GH_HOST: Optional. The GitHub host to use. We'll figure out the host from `BUILDKITE_*` env vars if not set.
# GH_HOST: Optional. The GitHub host to use. We'll figure out the host from `BUILDKITE_REPO` env var if not set.
#
# Usage:
# github_api <endpoint> [curl-options]
Expand All @@ -23,8 +23,8 @@ shift

github_host=${GH_HOST:-}
if [[ -z "${github_host}" ]]; then
if [[ -n "${BUILDKITE_PULL_REQUEST_REPO:-}" ]]; then
github_host=$(echo "$BUILDKITE_PULL_REQUEST_REPO" | awk -F[/:] '{print $4}')
if [[ "${BUILDKITE_REPO:-}" =~ ^(https?://|git@)([^/:]+)[:/] ]]; then
github_host="${BASH_REMATCH[2]}"
else
github_host=github.com
fi
Expand Down

0 comments on commit c4e9a60

Please sign in to comment.