Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logic of github_api to autodetect host #127

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading