Skip to content

Commit 87fe98f

Browse files
authored
docs: Document remove-labels safe output type (#11425)
1 parent 1151c12 commit 87fe98f

9 files changed

Lines changed: 104 additions & 7 deletions

File tree

.changeset/patch-docs-remove-labels-safe-output.md

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.changeset/patch-document-remove-labels-safe-output.md

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.changeset/patch-document-remove-labels.md

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/smoke-codex.lock.yml

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/smoke-codex.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,6 @@ Add a **very brief** comment (max 5-10 lines) to the current pull request with:
9090

9191
Use the `add_comment` tool to add a **mystical oracle-themed comment** to the latest discussion (using the `discussion_number` you extracted in step 8) - be creative and use mystical language like "🔮 The ancient spirits stir..."
9292

93-
If all tests pass, add the label `smoke-codex` to the pull request.
93+
If all tests pass:
94+
- Use the `add_labels` safe-output tool to add the label `smoke-codex` to the pull request
95+
- Use the `remove_labels` safe-output tool to remove the label `smoke` from the pull request

.github/workflows/smoke-copilot.lock.yml

Lines changed: 26 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/smoke-copilot.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,5 @@ strict: true
104104
3. Use the `add_comment` tool to add a **fun and creative comment** to the latest discussion (using the `discussion_number` you extracted in step 7) - be playful and entertaining in your comment
105105

106106
If all tests pass:
107-
- Add the label `smoke-copilot` to the pull request
108-
- Remove the label `smoke` from the pull request
107+
- Use the `add_labels` safe-output tool to add the label `smoke-copilot` to the pull request
108+
- Use the `remove_labels` safe-output tool to remove the label `smoke` from the pull request

docs/src/content/docs/reference/safe-outputs.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ The agent requests issue creation; a separate job with `issues: write` creates i
4747
- [**Add Comment**](#comment-creation-add-comment) (`add-comment`) — Post comments on issues, PRs, or discussions (max: 1)
4848
- [**Hide Comment**](#hide-comment-hide-comment) (`hide-comment`) — Hide comments on issues, PRs, or discussions (max: 5)
4949
- [**Add Labels**](#add-labels-add-labels) (`add-labels`) — Add labels to issues or PRs (max: 3)
50+
- [**Remove Labels**](#remove-labels-remove-labels) (`remove-labels`) — Remove labels from issues or PRs (max: 3)
5051
- [**Add Reviewer**](#add-reviewer-add-reviewer) (`add-reviewer`) — Add reviewers to pull requests (max: 3)
5152
- [**Assign Milestone**](#assign-milestone-assign-milestone) (`assign-milestone`) — Assign issues to milestones (max: 1)
5253
- [**Assign to Agent**](#assign-to-agent-assign-to-agent) (`assign-to-agent`) — Assign Copilot agents to issues or PRs (max: 1)
@@ -211,6 +212,33 @@ safe-outputs:
211212
target-repo: "owner/repo" # cross-repository
212213
```
213214

215+
### Remove Labels (`remove-labels:`)
216+
217+
Removes labels from issues or PRs. Specify `allowed` to restrict which labels can be removed. If a label is not present on the item, it will be silently skipped.
218+
219+
```yaml wrap
220+
safe-outputs:
221+
remove-labels:
222+
allowed: [automated, stale] # restrict to specific labels (optional)
223+
max: 3 # max operations (default: 3)
224+
target: "*" # "triggering" (default), "*", or number
225+
target-repo: "owner/repo" # cross-repository
226+
```
227+
228+
**Target**: `"triggering"` (requires issue/PR event), `"*"` (any issue/PR), or number (specific issue/PR).
229+
230+
When `allowed` is omitted or set to `null`, any labels can be removed. Use `allowed` to restrict removal to specific labels only, providing control over which labels agents can manipulate.
231+
232+
**Example use case**: Label lifecycle management where agents add temporary labels during triage and remove them once processed.
233+
234+
```yaml wrap
235+
safe-outputs:
236+
add-labels:
237+
allowed: [needs-triage, automation]
238+
remove-labels:
239+
allowed: [needs-triage] # agents can remove triage label after processing
240+
```
241+
214242
### Add Reviewer (`add-reviewer:`)
215243

216244
Adds reviewers to pull requests. Specify `reviewers` to restrict to specific GitHub usernames.

pkg/workflow/js/safe_outputs_tools.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,30 @@
361361
"additionalProperties": false
362362
}
363363
},
364+
{
365+
"name": "remove_labels",
366+
"description": "Remove labels from an existing GitHub issue or pull request. Silently skips labels that don't exist on the item. Use this to clean up labels or manage label lifecycles (e.g., removing 'needs-review' after review is complete).",
367+
"inputSchema": {
368+
"type": "object",
369+
"properties": {
370+
"labels": {
371+
"type": "array",
372+
"items": {
373+
"type": "string"
374+
},
375+
"description": "Label names to remove (e.g., ['smoke', 'needs-triage']). Non-existent labels are silently skipped."
376+
},
377+
"item_number": {
378+
"type": "number",
379+
"description": "Issue or PR number to remove labels from. This is the numeric ID from the GitHub URL (e.g., 456 in github.com/owner/repo/issues/456). If omitted, removes labels from the item that triggered this workflow."
380+
}
381+
},
382+
"required": [
383+
"labels"
384+
],
385+
"additionalProperties": false
386+
}
387+
},
364388
{
365389
"name": "add_reviewer",
366390
"description": "Add reviewers to a GitHub pull request. Reviewers receive notifications and can approve or request changes. Use 'copilot' as a reviewer name to request the Copilot PR review bot.",
@@ -1062,4 +1086,4 @@
10621086
"additionalProperties": false
10631087
}
10641088
}
1065-
]
1089+
]

0 commit comments

Comments
 (0)