@@ -195,9 +195,17 @@ jobs:
|
195 | 195 | run: | |
196 | 196 | set -euo pipefail |
197 | 197 | SELECTED_SHA="$(git rev-parse HEAD)" |
198 | | - auth_header="$(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 | tr -d '\n')" |
199 | | - git -c "http.https://github.com/.extraheader=AUTHORIZATION: basic ${auth_header}" fetch --no-tags origin '+refs/heads/*:refs/remotes/origin/*' |
200 | | - git -c "http.https://github.com/.extraheader=AUTHORIZATION: basic ${auth_header}" fetch --tags origin '+refs/tags/*:refs/tags/*' |
| 198 | + git_fetch_with_checkout_auth() { |
| 199 | + if git config --get-all http.https://github.com/.extraheader >/dev/null; then |
| 200 | + git fetch "$@" |
| 201 | + return |
| 202 | + fi |
| 203 | + local auth_header |
| 204 | + auth_header="$(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 | tr -d '\n')" |
| 205 | + git -c "http.https://github.com/.extraheader=AUTHORIZATION: basic ${auth_header}" fetch "$@" |
| 206 | + } |
| 207 | + git_fetch_with_checkout_auth --no-tags origin '+refs/heads/*:refs/remotes/origin/*' |
| 208 | + git_fetch_with_checkout_auth --tags origin '+refs/tags/*:refs/tags/*' |
201 | 209 | |
202 | 210 | if git tag --points-at "${SELECTED_SHA}" | grep -Eq '^v'; then |
203 | 211 | exit 0 |
@@ -248,8 +256,16 @@ jobs:
|
248 | 256 | exit 1 |
249 | 257 | fi |
250 | 258 | alpha_branch="${WORKFLOW_REF#refs/heads/}" |
251 | | - auth_header="$(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 | tr -d '\n')" |
252 | | - git -c "http.https://github.com/.extraheader=AUTHORIZATION: basic ${auth_header}" fetch --no-tags origin "+refs/heads/${alpha_branch}:refs/remotes/origin/${alpha_branch}" |
| 259 | + git_fetch_with_checkout_auth() { |
| 260 | + if git config --get-all http.https://github.com/.extraheader >/dev/null; then |
| 261 | + git fetch "$@" |
| 262 | + return |
| 263 | + fi |
| 264 | + local auth_header |
| 265 | + auth_header="$(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 | tr -d '\n')" |
| 266 | + git -c "http.https://github.com/.extraheader=AUTHORIZATION: basic ${auth_header}" fetch "$@" |
| 267 | + } |
| 268 | + git_fetch_with_checkout_auth --no-tags origin "+refs/heads/${alpha_branch}:refs/remotes/origin/${alpha_branch}" |
253 | 269 | if ! git merge-base --is-ancestor "${SELECTED_SHA}" "refs/remotes/origin/${alpha_branch}"; then |
254 | 270 | echo "Alpha release target ${SELECTED_SHA} must be reachable from ${alpha_branch}." >&2 |
255 | 271 | exit 1 |
|