diff --git a/.github/workflows/branch_archive.yml b/.github/workflows/branch_archive.yml index 93a4bcb7..5903f2b2 100644 --- a/.github/workflows/branch_archive.yml +++ b/.github/workflows/branch_archive.yml @@ -78,6 +78,15 @@ jobs: repository: ${{ github.repository_owner }}/PyAutoGut path: .gut fetch-depth: 1 + # Load-bearing. With the default (true), checkout writes an + # `http.https://github.com/.extraheader` auth header into this + # clone's config, and that header WINS over credentials embedded in + # a remote URL. The archive push then goes out as + # github-actions[bot] — which has no access to a sibling repo — and + # fails 403 no matter what `git remote set-url` was told. Leaving it + # on cost one run to discover; the dry run caught it before any + # delete, which is the only reason that was cheap. + persist-credentials: false - uses: actions/setup-python@v5 with: @@ -134,6 +143,13 @@ jobs: echo "::endgroup::" echo "::group::Archive into the Gut" + # Confirm no inherited credential is about to hijack the push. An + # extraheader here means the archive would go out as the workflow + # identity instead of the PAT — the 403 that cost run #1. + if git config --local --get-regexp 'http\..*\.extraheader' >/dev/null 2>&1; then + echo "::error::the Gut checkout carries a persisted credential; it would override the PAT." + exit 1 + fi # The Gut owns its own namespace and its own refusal-to-overwrite. PYAUTO_GUT_REMOTE=origin bin/pyauto-gut archive __to_archive__ "$name" echo "::endgroup::"