From ed5a4dd6e510f2f508eeea1792adc56e1ed8ee33 Mon Sep 17 00:00:00 2001 From: Zehui Chen Date: Fri, 30 Oct 2026 10:17:59 +0800 Subject: [PATCH] ci: fix git push auth with long GITHUB_TOKEN GITHUB_TOKEN now uses a new format that is about 377 characters long. Both deployment jobs encode it with plain base64, whose output is wrapped at 76 columns. The newlines embedded in the http.extraheader value make the header malformed, so GitHub resets the request and the push fails with: fatal: unable to access 'https://github.com/apache/teaclave-website.git/': HTTP/2 stream 1 was not closed cleanly before end of the underlying stream Encode the credentials with base64 -w0 so that they stay on a single line. While at it, use printf instead of echo -n, as the former does not interpret escape sequences. --- .github/workflows/deploy-staging.yml | 5 ++++- .github/workflows/promote-staging-to-production.yml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index c69af16277..ff7ef9b5df 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -92,7 +92,10 @@ jobs: git config user.email "github-actions[bot]@users.noreply.github.com" # Configure authentication (token in memory only) - git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n x-access-token:${GITHUB_TOKEN} | base64)" + # Use `base64 -w0`: plain `base64` wraps lines at 76 chars, and the + # current GITHUB_TOKEN is long enough that wrapping inserts newlines + # into the header value, which GitHub rejects (HTTP/2 stream reset). + git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic $(printf 'x-access-token:%s' "${GITHUB_TOKEN}" | base64 -w0)" # Deploy using ghp-import (includes dotfiles like .asf.yaml and .nojekyll) echo "Creating asf-staging branch..." diff --git a/.github/workflows/promote-staging-to-production.yml b/.github/workflows/promote-staging-to-production.yml index 02aeaae96c..d5990d88b9 100644 --- a/.github/workflows/promote-staging-to-production.yml +++ b/.github/workflows/promote-staging-to-production.yml @@ -63,7 +63,10 @@ jobs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n x-access-token:${GITHUB_TOKEN} | base64)" + # Use `base64 -w0`: plain `base64` wraps lines at 76 chars, and the + # current GITHUB_TOKEN is long enough that wrapping inserts newlines + # into the header value, which GitHub rejects (HTTP/2 stream reset). + git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic $(printf 'x-access-token:%s' "${GITHUB_TOKEN}" | base64 -w0)" # Push asf-staging to asf-site (replace production with staging content) git push https://github.com/${GITHUB_REPOSITORY}.git origin/asf-staging:asf-site --force