Skip to content

Fix push_to_pull_request_branch failing after clean_git_credentials.sh cleans .git/config#20524

Merged
pelikhan merged 2 commits intomainfrom
copilot/fix-clean-git-credentials-script
Mar 11, 2026
Merged

Fix push_to_pull_request_branch failing after clean_git_credentials.sh cleans .git/config#20524
pelikhan merged 2 commits intomainfrom
copilot/fix-clean-git-credentials-script

Conversation

Copy link
Contributor

Copilot AI commented Mar 11, 2026

clean_git_credentials.sh strips git credentials from .git/config as a security measure before the agent runs. The push_to_pull_request_branch safe outputs handler subsequently fails on git fetch/git push with exit code 128 because no credentials remain.

Changes

  • git_helpers.cjs — New getGitAuthEnv(token?) helper that builds GIT_CONFIG_COUNT/GIT_CONFIG_KEY_0/GIT_CONFIG_VALUE_0 env vars injecting an Authorization: basic <base64(x-access-token:TOKEN)> header scoped to GITHUB_SERVER_URL. Falls back to process.env.GITHUB_TOKEN; returns {} when no token is available. Credentials stay in process env and never touch .git/config.

  • push_to_pull_request_branch.cjs — Imports getGitAuthEnv, computes auth env once at factory level (preferring per-handler github-token for cross-repo PATs), then passes it to the git fetch and git push calls:

    await exec.exec("git", ["fetch", "origin", `${branchName}:refs/remotes/origin/${branchName}`], {
      env: { ...process.env, ...gitAuthEnv },
    });
  • generate_git_patch.cjs — Replaces ~10 lines of identical inline auth setup with a call to getGitAuthEnv().

  • git_helpers.test.cjs — Tests for getGitAuthEnv covering token override precedence, GITHUB_TOKEN fallback, no-token empty-object return, GITHUB_SERVER_URL scoping, and trailing-slash stripping.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GO111MODULE datedAt,event,hestatus git rev-�� --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/git 738450177/.githugit .cfg 64/pkg/tool/linu--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh repo view --json owner,name --jq .owner.login &#43; &#34;/&#34; &#43; .name /usr/bin/git sistency_WithImpgit -buildtags /usr/bin/infocmp--show-toplevel git rev-�� --show-toplevel infocmp /usr/bin/git xterm-color -tests ed } } git (http block)
    • Triggering command: /usr/bin/gh gh repo view owner/repo rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/compile /usr/bin/infocmp /tmp/go-build190git -trimpath /usr/bin/git infocmp -1 xterm-color git /usr/bin/git /tmp/gh-aw-test-git rev-parse /usr/bin/git git (http block)
  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha uts.version -test.v=true /usr/bin/git -test.timeout=10git -test.run=^Test -test.short=true--show-toplevel git rev-�� --git-dir tCvyK1taGOl6 /usr/bin/git -json GO111MODULE x_amd64/vet git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha k/gh-aw/gh-aw/.github/workflows -buildtags ache/node/24.14.0/x64/bin/node -errorsas -ifaceassert -nilfunc /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linusecurity t-64�� sistency_GoAndJavaScript3891061811/001/test-fronOUTPUT -buildtags /usr/bin/gh -errorsas -ifaceassert -nilfunc gh (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel x_amd64/vet /usr/bin/git b/workflows GO111MODULE x_amd64/vet git rev-�� --show-toplevel x_amd64/vet /usr/bin/git -json GO111MODULE x_amd64/vet git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/git 11/001/test-frongit GO111MODULE .cfg git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linutest@example.com /usr/bin/git se 9480855/b041/vetrev-parse .cfg git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --show-toplevel sh /usr/bin/git &#34;prettier&#34; --chegit node 64/bin/go git conf�� --get remote.origin.url /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --show-toplevel node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --check scripts/**/*.js 64/bin/go node /tmp�� /tmp/TestHashConsistency_GoAndJavaScript3891061811/001/test-fronv1.0.0 go /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --show-toplevel DN/N6GE9dzJuLpfUe9tz4e_/aZSvDGNgtest@example.com /usr/bin/git -json GO111MODULE 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linusecurity /usr/bin/git -json GO111MODULE .cfg git (http block)
  • https://api.github.com/repos/actions/download-artifact/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq .object.sha stall-gh-aw.sh to actions/setup-cli/install.sh...&#34; GO111MODULE dAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linutest@example.com (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq .object.sha 0040-27638/test-3935596915 9480855/b116/vet.cfg ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linu5 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq .object.sha g_.a GOPROXY /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOSUMDB util 64/bin/go /opt/hostedtoolc--jq -uns�� jpq_JbW5I /tmp/go-build1909480855/b038/vet.cfg 9480855/b354/vet.cfg g/mathutil/mathugit GO111MODULE 64/bin/go ortcfg (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha npx prettier --cGOSUMDB GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go sh -c &#34;prettier&#34; --che-errorsas node 64/bin/go tierignore generate_git_pat-atomic 64/bin/go go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha 9613555/b401/embedcfg **/*.cjs 64/bin/go **/*.json --ignore-path ../../../.pretti-unreachable=false /opt/hostedtoolc/tmp/go-build1909480855/b241/vet.cfg -o /tmp/go-build3229613555/b383/_pkGOINSECURE -trimpath 64/bin/go -p github.com/githu-atomic -lang=go1.25 go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha che/go-build/9c/9c4f279ab7522d19GOINSECURE **/*.cjs 64/bin/go **/*.json --ignore-path run-script/lib/n-bool go list�� -m -json 64/bin/go prettier --write 64/bin/go go (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha xterm-color node /usr/bin/git --check scripts/**/*.js 64/bin/go git remo�� add origin /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha /tmp/gh-aw-test-runs/20260311-140040-27638/test-1701271078/.github/workflows config /usr/bin/git remote.origin.urgit scripts/**/*.js 64/bin/go git conf�� user.name Test User /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
  • https://api.github.com/repos/actions/upload-artifact/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha 9480855/b392/_pkg_.a -parallel=4 0/x64/bin/node -run=^Test ./... -short /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linutest@example.com t-ha�� ithub/workflows/archie.md (http block)
  • https://api.github.com/repos/actions/upload-artifact/git/ref/tags/v7
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha -json .cfg x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link env -json GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE Fj/loOf-cgjR6MKz0XVD7GS/mRL0tEU7JbrieQ94-F8q (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json rsion=17c3c6a-dirty ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet estl�� -json GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linutest@example.com (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 0/x64/bin/node e/git : ${{ github.repgit -buildtags /usr/bin/git e/git rev-�� --show-toplevel git /usr/bin/git s/test.md -tests /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet estl�� -json GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 0/x64/bin/node /usr/bin/git -bool -buildtags /usr/bin/infocmp/tmp/gh-aw-test-runs/20260311-140147-32462/test-3437615164 git rev-�� --show-toplevel infocmp x_amd64/vet runs/20260311-14git -tests /usr/bin/infocmp--show-toplevel x_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE dx8vjli/h6bNdPCflz1EHL_uQAkD env -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuremote.origin.url (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 0/x64/bin/node /usr/bin/git r-test3316934410git -buildtags /opt/hostedtoolc/tmp/gh-aw-test-runs/20260311-140147-32462/test-3437615164 git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linu-tests /usr/bin/git runs/20260311-14git -trimpath /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/pkg/tool/linu-test.short=true GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/compile env g_.a GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 ache/go/1.25.0/x--jq /usr/bin/git 9480855/b427/_pkgit -buildtags 9480855/b427=&gt; git rev-�� --show-toplevel git /usr/bin/git bW5I/-pOH6J5YoELgit s/test.md /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet estl�� -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git -bool -buildtags clusion,workflow--show-toplevel git rev-�� --show-toplevel git /usr/bin/git s/test.md -tests /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE 64/pkg/tool/linu-lang=go1.25 GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linu-dwarf=false estl�� -json .cfg 64/pkg/tool/linu-nolocalimports GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linu/tmp/go-build1909480855/b436/_testmain.go (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 ache/go/1.25.0/x64/pkg/tool/linu--jq /usr/bin/git 9480855/b424/tesgit -buildtags 9480855/b424/imp/tmp/gh-aw-test-runs/20260311-140147-32462/test-3437615164 git rev-�� --show-toplevel 7JbrieQ94-F8q/4N_hV3O2Cg4KalLpCxFj/loOf-cgjR6MKz0XVD7GS/mRL0tEU7JbrieQ94-F8q /usr/bin/git ry=1 -tests ache/node/24.14.--show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE 64/pkg/tool/linu-importcfg GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linu/home/REDACTED/work/gh-aw/gh-aw/pkg/styles/theme_test.go estl�� -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 0/x64/bin/node /usr/bin/git ons-test24463591git -buildtags /usr/bin/git git rev-�� --show-toplevel git x_amd64/vet --show-toplevel -tests /usr/bin/git x_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path prettier --check 64/bin/go **/*.ts **/*.json --ignore-path /bin/sh -c GOPATH=$(go env -errorsas bash 64/bin/go -d (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path /repos/actions/download-artifact/git/ref/tags/v8 --jq /usr/bin/git 0040-27638/test-git 9480855/b116/vetrev-parse ache/go/1.25.0/x--show-toplevel git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linu5 /usr/bin/git se 9480855/b266/vetrev-parse 9480855/b392/con--show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw/contents/.github/workflows/shared/reporting.md
    • Triggering command: /tmp/go-build1022736943/b383/cli.test /tmp/go-build1022736943/b383/cli.test -test.testlogfile=/tmp/go-build1022736943/b383/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true 0040-27638/test-git 9480855/b063/vetrev-parse 64/pkg/tool/linu--show-toplevel git 0/x6�� --show-toplevel 64/pkg/tool/linux_amd64/compile /usr/bin/git g_.a 9480855/b244/vetrev-parse ache/go/1.25.0/x--show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha -json GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env 1901980807/.github/workflows .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq .object.sha /tmp/go-build3229613555/b376/_pkGOINSECURE -trimpath 64/bin/go -p github.com/davec-atomic -lang=go1.16 go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq .object.sha --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git se 9480855/b309/vetrev-parse /opt/hostedtoolc--show-toplevel git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git itattributes-tesgit /tmp/go-build190-C ache/go/1.25.0/x/tmp/gh-aw-test-runs/20260311-140147-32462/test-2961494537/.github/workflows git (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v2.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha /tmp/go-build3229613555/b378/_pkGOINSECURE -trimpath 64/bin/go -d github.com/stret-atomic -lang=go1.17 go env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha /tmp/go-build3229613555/b386/_pkGOINSECURE -trimpath 64/bin/go -p github.com/ayman-atomic -lang=go1.23 go env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha /tmp/go-build3229613555/b393/_pkGOINSECURE -trimpath 64/bin/go -p main -lang=go1.25 go env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v3.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v3.0.0 --jq .object.sha /tmp/go-build3229613555/b381/_pkGOINSECURE -trimpath 64/bin/go -p github.com/stret-atomic -lang=go1.17 go env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v3.0.0 --jq .object.sha --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git -json GO111MODULE ache/go/1.25.0/x--show-toplevel git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/compile (http block)
  • https://api.github.com/repos/nonexistent/action/git/ref/tags/v999.999.999
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha -json GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD a558eea7 64/pkg/tool/linux_amd64/vet env -json .cfg x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
  • https://api.github.com/repos/nonexistent/repo/actions/runs/12345
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion avXW/rJDXzTCvlTSgit -buildtags /usr/bin/git git rev-�� ster.patch 9480855/b421/importcfg /opt/hostedtoolcache/go/1.25.0/x-nilfunc k/gh-aw/gh-aw/pkgit k/gh-aw/gh-aw/pkrev-parse ache/node/24.14.--show-toplevel node (http block)
  • https://api.github.com/repos/owner/repo/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go **/*.ts **/*.json --ignore-path go list�� -mod=readonly -e 64/bin/go -d in/esbuild 64/bin/go go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOSUMDB GOWORK 64/bin/go git cat-�� blob 17c3c6ad9c3eec81-nolocalimports 64/bin/go --noprofile (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo /usr/bin/git 0040-27638/test-git GO111MODULE ache/go/1.25.0/x--show-toplevel git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git -json GO111MODULE 9480855/b150/vet--show-toplevel git (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build1909480855/b383/cli.test /tmp/go-build1909480855/b383/cli.test -test.testlogfile=/tmp/go-build1909480855/b383/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOSUMDB GOWORK 64/bin/go sh -c &#34;prettier&#34; --check &#39;scripts/**/*GOINSECURE sh 64/bin/go &#34;vitest&#34; run gen/opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /tmp/go-build1022736943/b383/cli.test /tmp/go-build1022736943/b383/cli.test -test.testlogfile=/tmp/go-build1022736943/b383/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true 0040-27638/test-git 9480855/b063/vetrev-parse 64/pkg/tool/linu--show-toplevel git 0/x6�� --show-toplevel 64/pkg/tool/linux_amd64/compile /usr/bin/git g_.a 9480855/b244/vetrev-parse ache/go/1.25.0/x--show-toplevel git (http block)
  • https://api.github.com/repos/test-owner/test-repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name ./cmd/gh-aw GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go node /hom�� --check scripts/**/*.js 64/bin/go .prettierignore generate_git_pat-unsafeptr=false 64/bin/go go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name /repos/actions/upload-artifact/git/ref/tags/v7 --jq /usr/bin/git 0040-27638/test-git 9480855/b117/vetrev-parse ache/go/1.25.0/x--show-toplevel git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linu^remote\..*\.gh-resolved$ /usr/bin/git -json stmain.go ache/go/1.25.0/x--show-toplevel git (http block)
  • https://api.github.com/repos/test/repo
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch --show-toplevel gh /usr/bin/git list --json /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git git (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ials.sh

Add getGitAuthEnv() helper to git_helpers.cjs that builds GIT_CONFIG_*
environment variables encoding an Authorization header for git network
operations. This avoids relying on .git/config credentials that are
cleaned by clean_git_credentials.sh before the agent runs.

Update push_to_pull_request_branch.cjs to use getGitAuthEnv() for the
git fetch and git push operations, switching to args-array form with env
option to pass the auth header.

Refactor generate_git_patch.cjs to use the shared getGitAuthEnv helper
(removes inline duplicate code).

Fixes: clean_git_credentials.sh breaks push_to_pull_request_branch

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix clean_git_credentials.sh affecting push_to_pull_request_branch Fix push_to_pull_request_branch failing after clean_git_credentials.sh cleans .git/config Mar 11, 2026
@pelikhan pelikhan marked this pull request as ready for review March 11, 2026 14:11
Copilot AI review requested due to automatic review settings March 11, 2026 14:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes push_to_pull_request_branch failures caused by clean_git_credentials.sh removing credentials from .git/config by injecting GitHub auth headers via GIT_CONFIG_* env vars for git network operations.

Changes:

  • Added getGitAuthEnv(token?) helper to generate GIT_CONFIG_* env vars for http.<server>/.extraheader auth without touching .git/config.
  • Updated push_to_pull_request_branch to pass the auth env into git fetch and git push, preferring per-handler github-token.
  • Refactored generate_git_patch to reuse the shared auth env helper and added unit tests for getGitAuthEnv.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
actions/setup/js/git_helpers.cjs Adds getGitAuthEnv() helper for env-based git HTTP auth header injection.
actions/setup/js/push_to_pull_request_branch.cjs Uses getGitAuthEnv() and passes auth env to git fetch/git push exec calls.
actions/setup/js/generate_git_patch.cjs Replaces inline auth-env construction with getGitAuthEnv() for incremental fetch.
actions/setup/js/git_helpers.test.cjs Adds unit tests validating getGitAuthEnv() behavior and precedence rules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 383 to +386
core.info(`Fetching branch: ${branchName}`);
await exec.exec(`git fetch origin ${branchName}:refs/remotes/origin/${branchName}`);
await exec.exec("git", ["fetch", "origin", `${branchName}:refs/remotes/origin/${branchName}`], {
env: { ...process.env, ...gitAuthEnv },
});
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new authentication behavior (passing env: { ...process.env, ...gitAuthEnv } into exec.exec for git fetch/git push) isn’t covered by the existing push_to_pull_request_branch tests. Please add an assertion that the fetch/push calls include GIT_CONFIG_COUNT/GIT_CONFIG_KEY_0/GIT_CONFIG_VALUE_0 when a token is available (and that the per-handler github-token takes precedence over process.env.GITHUB_TOKEN).

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit 7d3f227 into main Mar 11, 2026
111 checks passed
@pelikhan pelikhan deleted the copilot/fix-clean-git-credentials-script branch March 11, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clean_git_credentials.sh breaks push_to_pull_request_branch

3 participants