Add create-pull-request safe output to mention-in-pr workflows for fork PRs#487
Add create-pull-request safe output to mention-in-pr workflows for fork PRs#487
Conversation
…rk PRs When a PR comes from a fork, the agent can now create a new PR in the base repo with the proposed changes instead of just telling the user it can't push to fork branches. Changes: - Add safe-output-create-pr.md fragment import to mention-in-pr, mention-in-pr-no-sandbox, and mention-in-pr-by-id workflows - Add draft-prs input to all three workflows - Update fork PR instructions to use create_pull_request - Update safe-output-push-to-pr.md fragment fork guidance - Update README.md files with new safe output and input - Recompile all lock files Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
📝 WalkthroughWalkthroughThis pull request extends GitHub Actions workflows to support creating new pull requests as an alternative to pushing changes directly, particularly for fork scenarios. The changes introduce a new Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/gh-aw-fragments/safe-output-push-to-pr.md (1)
90-94:⚠️ Potential issue | 🔴 CriticalRemove reference to non-existent
baseRefNamefield.The documented guidance references
baseRefNamefrom/tmp/pr-context/pr.json, but this field does not exist. The pr.json structure only containsheadRefOid. Either addbaseRefNameto pr.json during generation or rewrite the merge conflict resolution guidance to use an alternative method to determine the base branch name.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/gh-aw-fragments/safe-output-push-to-pr.md around lines 90 - 94, The doc references a nonexistent pr.json field `baseRefName`; update the guidance so it either (A) instructs the generator that creates /tmp/pr-context/pr.json to include a `baseRefName` entry derived from the PR metadata, or (B) replace `baseRefName` usage with a supported alternative (e.g., use `headRefOid` where appropriate or derive the base branch via the GitHub action/ENV like GITHUB_BASE_REF or from the PR API) and update the steps that mention resolving merge conflicts accordingly; ensure references to `push_to_pull_request_branch` and `ready_to_push_to_pr` remain consistent with the chosen approach.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/gh-aw-mention-in-pr-by-id.lock.yml:
- Around line 68-72: The new input "draft-prs" is defined but never passed into
the PR creation logic; update the source workflow/fragment that generates
create_pull_request so the handler consumes inputs.draft-prs (e.g., pass it into
the create_pull_request action or the function that constructs the PR payload)
and wire it through the safe-output/configuration handler path so the draft flag
is honored; do this change in the source workflow/fragment (not the compiled
.lock.yml), recompile the workflow to regenerate the .lock.yml, and ensure any
references to create_pull_request, safe-output handler, or the PR payload
builder include the draft boolean (inputs.draft-prs) propagation.
---
Outside diff comments:
In @.github/workflows/gh-aw-fragments/safe-output-push-to-pr.md:
- Around line 90-94: The doc references a nonexistent pr.json field
`baseRefName`; update the guidance so it either (A) instructs the generator that
creates /tmp/pr-context/pr.json to include a `baseRefName` entry derived from
the PR metadata, or (B) replace `baseRefName` usage with a supported alternative
(e.g., use `headRefOid` where appropriate or derive the base branch via the
GitHub action/ENV like GITHUB_BASE_REF or from the PR API) and update the steps
that mention resolving merge conflicts accordingly; ensure references to
`push_to_pull_request_branch` and `ready_to_push_to_pr` remain consistent with
the chosen approach.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
.github/workflows/gh-aw-fragments/safe-output-push-to-pr.md.github/workflows/gh-aw-mention-in-pr-by-id.lock.yml.github/workflows/gh-aw-mention-in-pr-by-id.md.github/workflows/gh-aw-mention-in-pr-no-sandbox.lock.yml.github/workflows/gh-aw-mention-in-pr-no-sandbox.md.github/workflows/gh-aw-mention-in-pr.lock.yml.github/workflows/gh-aw-mention-in-pr.md.github/workflows/gh-aw-pr-actions-fixer.lock.yml.github/workflows/gh-aw-pr-review-addresser.lock.ymlgh-agent-workflows/mention-in-pr-by-id/README.mdgh-agent-workflows/mention-in-pr-no-sandbox/README.mdgh-agent-workflows/mention-in-pr/README.md
| draft-prs: | ||
| default: true | ||
| description: Whether to create pull requests as drafts | ||
| required: false | ||
| type: boolean |
There was a problem hiding this comment.
draft-prs input is added but not wired into PR creation behavior
Line 68 introduces draft-prs, but the create_pull_request path still uses generic/default behavior and does not consume inputs.draft-prs in the safe-output configuration/handler path. This makes the new input effectively non-functional for callers.
Based on learnings, this .lock.yml should not be edited directly; wire draft-prs in the source workflow/fragment and recompile.
Also applies to: 782-783, 820-823, 2117-2117
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/gh-aw-mention-in-pr-by-id.lock.yml around lines 68 - 72,
The new input "draft-prs" is defined but never passed into the PR creation
logic; update the source workflow/fragment that generates create_pull_request so
the handler consumes inputs.draft-prs (e.g., pass it into the
create_pull_request action or the function that constructs the PR payload) and
wire it through the safe-output/configuration handler path so the draft flag is
honored; do this change in the source workflow/fragment (not the compiled
.lock.yml), recompile the workflow to regenerate the .lock.yml, and ensure any
references to create_pull_request, safe-output handler, or the PR payload
builder include the draft boolean (inputs.draft-prs) propagation.
When mentioned in a fork PR, the agent previously could only say "I can't push to fork branches" and suggest the author apply changes themselves. Now it can create a new PR in the base repo with the proposed changes instead.
Changes
Workflow source files (
gh-aw-mention-in-pr.md,gh-aw-mention-in-pr-no-sandbox.md,gh-aw-mention-in-pr-by-id.md):safe-output-create-pr.mdfragmentdraft-prsinput (default:true)create_pull_requestinstead of giving upcreate_pull_requestto the Additional tools sectionsafe-output-push-to-pr.mdfragment: Updated fork PR guidance to recommendcreate_pull_requestas the alternativeREADME.md for all three workflows: Document new
draft-prsinput andcreate-pull-requestsafe outputLock files: Recompiled via
make compile(0 errors)Agent behavior change
Before (fork PR, asked to fix code):
After:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.