You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FAQ: add entry on controlling the agent's working branch at runtime (#29377)
Adds a new entry under 'Workflow Design' explaining how to use
preserve-branch-name and recreate-ref to have the agent apply changes
to a specific branch name extracted at runtime (e.g., from a Jira issue).
Closesgithub/agentic-workflows#513
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/src/content/docs/reference/faq.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
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
526
526
527
527
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.
528
528
529
+
### Can the agent use an existing branch specified at runtime (e.g., from a Jira issue)?
530
+
531
+
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:
532
+
533
+
```yaml wrap
534
+
safe-outputs:
535
+
create-pull-request:
536
+
preserve-branch-name: true # omit random salt suffix from agent-specified name
537
+
recreate-ref: true # force-reset remote branch if it already exists
538
+
```
539
+
540
+
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.
541
+
542
+
To pass the branch name from a Jira issue body (or any issue body), instruct the agent in your workflow's markdown:
543
+
544
+
```markdown
545
+
Read the issue body and extract the branch name from the line starting with
546
+
"Use existing branch:". Use that name when calling `create_pull_request`.
547
+
```
548
+
549
+
The agent reads the triggering issue body as part of its context, so no extra integration is needed when the branch name is embedded there. For richer Jira data (status, custom fields), use a [custom safe output](/gh-aw/reference/custom-safe-outputs/) or Jira MCP server.
550
+
551
+
> [!NOTE]
552
+
> `recreate-ref` requires `preserve-branch-name: true` to take effect. The agent always starts from the configured base branch — it doesn't literally check out the named branch before making changes.
553
+
554
+
See [Safe Outputs (Pull Requests)](/gh-aw/reference/safe-outputs-pull-requests/) for full configuration details.
555
+
529
556
### You use 'agent' and 'agentic workflow' interchangeably. Are they the same thing?
530
557
531
558
Yes, for the purpose of this technology. An **"agent"** is an agentic workflow in a repository - an AI-powered automation that can reason, make decisions, and take actions. We use **"agentic workflow"** as it's plainer and emphasizes the workflow nature of the automation, but the terms are synonymous in this context.
0 commit comments