fix(update/open_pr): strip every extraheader via regex + log what was hit

Previous attempts targeted a specific config key path
(`http.https://github.com/.extraheader`). If actions/checkout v6
stores it under a different subsection naming, our unset/remove-section
no-ops silently and the GITHUB_TOKEN-bearing header keeps overriding
the App-token URL credentials.

Walk every `http.*.extraheader` entry the local config holds, pipe
the matched key names through xargs to unset-all each one, and dump
the remaining `http.*` config before pushing so the next CI run
proves what was stripped. The push itself still uses an
x-access-token URL so the App's installation token is the only
Authorization that reaches the wire.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 4.7 committed 2026-05-28 13:23:27 +02:00
1 parent d950770385
commit 3dffbb8493
1 file changed
+7 -2
+7 -2
View File
@@ -79,8 +79,13 @@ if [[ -n "${DUPLICATE_PR}" ]]; then
exit 0
fi
git config --local --unset-all "http.https://github.com/.extraheader" 2>/dev/null || true # nocheck: url
git config --local --remove-section "http.https://github.com/" 2>/dev/null || true # nocheck: url
echo "--- Stripping every http.*.extraheader from local config ---"
git config --local --name-only --get-regexp '^http\..*\.extraheader$' 2>/dev/null |
tee /dev/stderr |
xargs -r -I{} git config --local --unset-all '{}' 2>/dev/null || true
echo "--- Remaining http.* config after strip: ---"
git config --local --get-regexp '^http\.' 2>/dev/null || true
echo "--- Pushing with App-token-embedded URL ---"
git push --force \
"https://x-access-token:${GH_TOKEN}@github.com/${REPO}.git" \
"HEAD:refs/heads/${BRANCH}"