-
Notifications
You must be signed in to change notification settings - Fork 375
[FAQ] Add: controlling the agent's working branch at runtime #29377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -526,6 +526,33 @@ One workflow is simpler to maintain and good for learning, while multiple workfl | |||||
|
|
||||||
| Either approach works well. AI-assisted authoring using `/agent agentic-workflows create` in GitHub Copilot Chat provides interactive guidance with automatic best practices, while manual editing gives full control and is essential for advanced customizations. See [Creating Workflows](/gh-aw/setup/creating-workflows/) for AI-assisted approach, or [Reference documentation](/gh-aw/reference/frontmatter/) for manual configuration. | ||||||
|
|
||||||
| ### Can the agent use an existing branch specified at runtime (e.g., from a Jira issue)? | ||||||
|
|
||||||
| The `create-pull-request` safe output always creates a new branch, but you can control its name and make it reuse an existing remote branch. Set these two fields in your workflow frontmatter: | ||||||
|
|
||||||
| ```yaml wrap | ||||||
| safe-outputs: | ||||||
| create-pull-request: | ||||||
| preserve-branch-name: true # omit random salt suffix from agent-specified name | ||||||
| recreate-ref: true # force-reset remote branch if it already exists | ||||||
| ``` | ||||||
|
|
||||||
| With `preserve-branch-name: true`, the agent's branch name (e.g., `feature/abc-123-my-change`) is used as-is instead of having a random hex suffix appended. With `recreate-ref: true`, if that branch already exists remotely, it is force-reset to the agent's current HEAD rather than falling back to creating an issue. | ||||||
|
||||||
| With `preserve-branch-name: true`, the agent's branch name (e.g., `feature/abc-123-my-change`) is used as-is instead of having a random hex suffix appended. With `recreate-ref: true`, if that branch already exists remotely, it is force-reset to the agent's current HEAD rather than falling back to creating an issue. | |
| With `preserve-branch-name: true`, the agent's branch name (e.g., `feature/abc-123-my-change`) is used as-is instead of having a random hex suffix appended. With `recreate-ref: true`, if that branch already exists remotely, it is force-reset to the agent's current HEAD rather than using the normal branch-collision behavior (by default, falling back to creating an issue when `fallback-as-issue: true`; otherwise failing PR creation). |
Copilot
AI
Apr 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make this actionable, it would help to mention the actual tool input name: the extracted name should be passed as the branch field in the create_pull_request call (per the tool schema).
| "Use existing branch:". Use that name when calling `create_pull_request`. | |
| "Use existing branch:". Pass that name as the `branch` field when calling `create_pull_request`. |
Copilot
AI
Apr 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“Jira issue body” is not part of the agent context unless you fetch it via an integration (e.g., MCP/custom job) or copy the relevant text into the triggering GitHub issue body. Consider rewording to distinguish “triggering GitHub issue body” (available by default) from “Jira issue body” (requires integration).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phrasing here is a bit misleading:
recreate-ref: truedoes not “reuse” the existing remote branch contents; it force-deletes/recreates the remote ref (force-push semantics) to point at the agent’s HEAD. Consider aligning terminology with the existing reference docs (e.g., “force-delete and recreate the remote branch ref”) and updating the inline comment that currently says “force-reset”.