Skip to content

docs: document add-labels safe-output capability in create-agentic-workflow.md#29054

Merged
pelikhan merged 2 commits intomainfrom
copilot/add-documentation-for-add-label-capability
Apr 29, 2026
Merged

docs: document add-labels safe-output capability in create-agentic-workflow.md#29054
pelikhan merged 2 commits intomainfrom
copilot/add-documentation-for-add-label-capability

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

add-labels safe-output was undocumented in the workflow creation guide, leaving engineers to guess whether to use update-issue with a labels array or direct gh issue edit --add-label in bash — both wrong approaches.

Changes

  • Security best practices list — added add-labels alongside create-issue, add-comment, etc.; added explicit anti-pattern callout for gh issue edit --add-label (bypasses allow-lists, rate limiting, audit trails)
  • Step 2 Safe Outputs quick-reference — new add-labels entry clarifying it's the dedicated tool (not update-issue with labels), with a minimal working example:
safe-outputs:
  add-labels:
    allowed: [bug, enhancement, needs-triage]  # restrict to safe labels
    max: 3

The entry notes that the safe-output job executes with issues: write / pull-requests: write permissions, separate from the read-only agent job.

…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>
Copilot AI changed the title [WIP] Document add-label safe-output capability in create-agentic-workflow docs: document add-labels safe-output capability in create-agentic-workflow.md Apr 29, 2026
Copilot AI requested a review from gh-aw-bot April 29, 2026 05:26
@pelikhan pelikhan marked this pull request as ready for review April 29, 2026 05:29
Copilot AI review requested due to automatic review settings April 29, 2026 05:29
@pelikhan pelikhan merged commit 2b5eed7 into main Apr 29, 2026
3 checks passed
@pelikhan pelikhan deleted the copilot/add-documentation-for-add-label-capability branch April 29, 2026 05:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-labels to the security best-practices list of preferred safe-outputs.
  • Adds an explicit anti-pattern warning against applying labels via gh CLI mutations in bash.
  • Extends the “Safe Outputs” quick reference with an add-labels entry 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-issue with a labels array because it “bypasses allow-list enforcement and audit trails,” but update-issue is itself a safe-outputs type (and the reference explicitly notes it can update labels). If the intent is “prefer add-labels because it supports an allowed: label allow-list (which update-issue lacks)”, please reword to avoid implying update-issue bypasses 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.
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“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.

Suggested change
- ❌ **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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Document add-label safe-output capability in create-agentic-workflow.md

4 participants