In a workflow I'm working on that checks out multiple repos I found a much more explicit prompt was needed to set the coding agent up for success in using push_to_pull_request_branch tool from one of the repos:
The checkouts are:
checkout:
- fetch-depth: 0
path: ./github-automation
- repository: github/github
token: ${{ ... }}
fetch: ["master", "dsyme/n-plus-1/*"]
fetch-depth: 20
path: ./github
sparse-checkout: |
...various directories...
and the explicit prompting I had to add was this:
**How `push_to_pull_request_branch` works with this layout:**
The `push_to_pull_request_branch` tool operates on the `github/github` checkout at `$GITHUB_WORKSPACE/github/`. To push fixes to an existing PR branch:
1. `cd $GITHUB_WORKSPACE/github`
2. `git checkout <pr-branch-name>` — the PR branches are fetched (see checkout config) and available as `origin/<branch>`. With fetch-depth=20 you can check them out locally.
3. Make your edits to the files on disk.
4. `git add <files> && git commit -m "<message>"`
5. Call `push_to_pull_request_branch` with `pull_request_number` and `branch` set to the PR's branch name.
**Critical:** The tool finds the git repo by scanning `$GITHUB_WORKSPACE` subdirectories. It will locate `$GITHUB_WORKSPACE/github/` as the `github/github` repo and find your branch there. You do NOT need to be in the workspace root. Just ensure the branch exists in `$GITHUB_WORKSPACE/github/` with committed changes.
**Do NOT** attempt to `git push` manually, rewrite remotes, or use `gh api` for pushing — the tool handles authentication and signing.
Some kind of sensible generic prompting along these lines should be emitted automatically by GH-AW when push-to-pull-request-branch safe output is used in multi-repo checkout: situations. Added notes should be added for sparseness, shallow depth etc. depending on the features used.
In a workflow I'm working on that checks out multiple repos I found a much more explicit prompt was needed to set the coding agent up for success in using
push_to_pull_request_branchtool from one of the repos:The checkouts are:
and the explicit prompting I had to add was this:
Some kind of sensible generic prompting along these lines should be emitted automatically by GH-AW when
push-to-pull-request-branchsafe output is used in multi-repocheckout:situations. Added notes should be added for sparseness, shallow depth etc. depending on the features used.