Conversation
…rkflow.md - Add `add-labels` to the safe-outputs list in security best practices (line 548) - Add anti-pattern note for `gh issue edit --add-label` direct CLI usage (line 549) - Add `add-labels` entry in Step 2 Safe Outputs quick-reference with YAML example showing `allowed:` restriction and note on `issues: write` / `pull-requests: write` - Clarify that `update-issue` with labels array is NOT the recommended pattern - Note `gh issue edit --add-label` in bash as anti-pattern in two locations Closes #add-label-safe-output-documentation Agent-Logs-Url: https://github.com/github/gh-aw/sessions/66da9063-2a8a-48e1-a77e-89feb2ed37f4 Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the workflow creation guide to document the add-labels safe-output capability and discourage unsafe labeling approaches outside the safe-output system.
Changes:
- Adds
add-labelsto the security best-practices list of preferred safe-outputs. - Adds an explicit anti-pattern warning against applying labels via
ghCLI mutations in bash. - Extends the “Safe Outputs” quick reference with an
add-labelsentry and minimal YAML example.
Show a summary per file
| File | Description |
|---|---|
| .github/aw/create-agentic-workflow.md | Documents safe-outputs: add-labels usage and adds guidance discouraging direct label mutations via gh CLI. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
.github/aw/create-agentic-workflow.md:830
- The doc says to avoid using
update-issuewith a labels array because it “bypasses allow-list enforcement and audit trails,” butupdate-issueis itself asafe-outputstype (and the reference explicitly notes it can update labels). If the intent is “preferadd-labelsbecause it supports anallowed:label allow-list (whichupdate-issuelacks)”, please reword to avoid implyingupdate-issuebypasses safe-output controls.
- **Applying labels** → `safe-outputs: add-labels:` — use a dedicated `add-labels` safe output, **not** `update-issue` with a `labels` array and **not** `gh issue edit --add-label` in bash (both bypass allow-list enforcement and audit trails). Example:
```yaml
- Files reviewed: 1/1 changed files
- Comments generated: 1
| - Default to `permissions: read-all` and expand only if necessary. | ||
| - Prefer `safe-outputs` (`create-issue`, `add-comment`, `create-pull-request`, `create-pull-request-review-comment`, `update-issue` for editing, `close-issue` for closing, `dispatch-workflow`) over granting write perms. | ||
| - Prefer `safe-outputs` (`create-issue`, `add-comment`, `create-pull-request`, `create-pull-request-review-comment`, `update-issue` for editing, `close-issue` for closing, `add-labels` for labeling, `dispatch-workflow`) over granting write perms. | ||
| - ❌ **Anti-pattern**: Do NOT use `gh issue edit --add-label` or `gh label` CLI commands directly in bash — these bypass safe-output controls (rate limiting, audit trails, allow-lists). Use `safe-outputs: add-labels:` instead. |
There was a problem hiding this comment.
“Do NOT use gh ... or gh label CLI commands directly in bash” is overly broad: gh label includes read-only operations like gh label list that don’t bypass safe-outputs. Consider narrowing this to the specific write commands/subcommands (e.g., gh issue edit --add-label, gh label create/delete/edit) or explicitly saying “label mutations via gh CLI”.
This issue also appears on line 829 of the same file.
| - ❌ **Anti-pattern**: Do NOT use `gh issue edit --add-label` or `gh label` CLI commands directly in bash — these bypass safe-output controls (rate limiting, audit trails, allow-lists). Use `safe-outputs: add-labels:` instead. | |
| - ❌ **Anti-pattern**: Do NOT use `gh issue edit --add-label` or label mutation commands such as `gh label create`, `gh label edit`, or `gh label delete` directly in bash — these bypass safe-output controls (rate limiting, audit trails, allow-lists). Use `safe-outputs: add-labels:` instead. |
add-labelssafe-output was undocumented in the workflow creation guide, leaving engineers to guess whether to useupdate-issuewith alabelsarray or directgh issue edit --add-labelin bash — both wrong approaches.Changes
add-labelsalongsidecreate-issue,add-comment, etc.; added explicit anti-pattern callout forgh issue edit --add-label(bypasses allow-lists, rate limiting, audit trails)add-labelsentry clarifying it's the dedicated tool (notupdate-issuewith labels), with a minimal working example:The entry notes that the safe-output job executes with
issues: write/pull-requests: writepermissions, separate from the read-only agent job.