Summary
When a workflow uses checkout: to check out a non-workflow repository into $GITHUB_WORKSPACE, the compiled lockfile's "Configure Git credentials" step resets origin back to the workflow's own repository URL:
- name: Configure Git credentials
env:
REPO_NAME: ${{ github.repository }} # <-- always the workflow repo
SERVER_URL: ${{ github.server_url }}
GITHUB_TOKEN: ${{ github.token }}
run: |
...
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
The on-disk repo contents are the target repo (e.g. gh-aw-side-repo), but git config --get remote.origin.url returns the workflow repo (e.g. gh-aw-test).
This breaks downstream multi-repo detection in find_repo_checkout.cjs, which walks the workspace looking for a .git whose remote matches the target. The match always fails because the URL has been overwritten.
Reproduction
Trigger any workflow with safe-outputs.create-pull-request (or push-to-pull-request-branch) that uses checkout: to a different repo than github.repository, in sample-replay mode.
Example from githubnext/gh-aw-test:
Sample MCP server response:
[safeoutputs] Multi-repo mode: looking for checkout of githubnext/gh-aw-side-repo
git config --get remote.origin.url
Git command output: https://github.com/githubnext/gh-aw-test.git
[safeoutputs] Failed to find repo checkout: Repository 'githubnext/gh-aw-side-repo' not found in workspace.
The handler then returns an error-shaped MCP response, no safe-output is emitted, and Process Safe Outputs reports Found 0 message(s) in agent output.
Expected
Either:
- The "Configure Git credentials" step should not overwrite
origin when the workspace is a checkout: of a different repo, or
find_repo_checkout.cjs should consult the existing checkout-manifest.json (built earlier in the same job at line ~410 of the lockfile) rather than relying on git config --get remote.origin.url after a credentials step has potentially clobbered it.
The checkout manifest already contains the correct mapping (githubnext/gh-aw-side-repo -> path=), so option (2) is a localized fix.
Affected tests in githubnext/gh-aw-test
test-copilot-siderepo-create-pull-request
test-copilot-siderepo-create-pull-request-review-comment
test-copilot-siderepo-create-two-pull-requests
All produce Found 0 message(s) in agent output despite samples being declared.
Repro lockfile snippet
- name: Checkout repository
uses: actions/checkout@... # gh-aw-test
- name: Checkout githubnext/gh-aw-side-repo
uses: actions/checkout@... # overwrites workspace
- name: Build checkout manifest for safe-outputs handlers
run: |
# ... produces checkout-manifest.json mapping githubnext/gh-aw-side-repo -> path=""
- name: Configure Git credentials
env:
REPO_NAME: ${{ github.repository }}
run: |
git remote set-url origin "...github.com/${REPO_NAME}.git" # <-- clobbers
- name: Replay safe-outputs samples (deterministic)
# MCP server now sees origin=gh-aw-test, fails to find side-repo, returns error
Summary
When a workflow uses
checkout:to check out a non-workflow repository into$GITHUB_WORKSPACE, the compiled lockfile's "Configure Git credentials" step resetsoriginback to the workflow's own repository URL:The on-disk repo contents are the target repo (e.g.
gh-aw-side-repo), butgit config --get remote.origin.urlreturns the workflow repo (e.g.gh-aw-test).This breaks downstream multi-repo detection in
find_repo_checkout.cjs, which walks the workspace looking for a.gitwhose remote matches the target. The match always fails because the URL has been overwritten.Reproduction
Trigger any workflow with
safe-outputs.create-pull-request(orpush-to-pull-request-branch) that usescheckout:to a different repo thangithub.repository, in sample-replay mode.Example from
githubnext/gh-aw-test:test-copilot-siderepo-create-pull-request.mdcheckout:declaresrepository: githubnext/gh-aw-side-reposafe-outputs.create-pull-requestdeclarestarget-repo: 'githubnext/gh-aw-side-repo'Sample MCP server response:
The handler then returns an error-shaped MCP response, no safe-output is emitted, and
Process Safe OutputsreportsFound 0 message(s) in agent output.Expected
Either:
originwhen the workspace is acheckout:of a different repo, orfind_repo_checkout.cjsshould consult the existingcheckout-manifest.json(built earlier in the same job at line ~410 of the lockfile) rather than relying ongit config --get remote.origin.urlafter a credentials step has potentially clobbered it.The checkout manifest already contains the correct mapping (
githubnext/gh-aw-side-repo -> path=), so option (2) is a localized fix.Affected tests in
githubnext/gh-aw-testtest-copilot-siderepo-create-pull-requesttest-copilot-siderepo-create-pull-request-review-commenttest-copilot-siderepo-create-two-pull-requestsAll produce
Found 0 message(s) in agent outputdespite samples being declared.Repro lockfile snippet