Skip to content

Conversation

pelikhan
Copy link
Contributor

Support for output that adds labels to current issue/pull_request

Copilot AI and others added 2 commits August 21, 2025 21:11
…abels output type (#6)

* Initial plan

* Implement label output type for agentic workflows

- Add LabelConfig struct with mandatory allowed field
- Create add_labels.cjs JavaScript implementation
- Update compiler parsing and job building logic
- Add comprehensive tests for new functionality
- Update schema to include labels output type
- Add documentation for label addition feature

The new label output type supports:
- Mandatory allow-list enforcement
- Strict addition-only operations (no removal)
- Line-by-line parsing with safety checks
- Subset validation of requested vs allowed labels
- Clear error messages for validation failures

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Add max-count option to labels output and move label code to separate file

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Rename Label field to Labels to match YAML configuration

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan requested a review from dsyme August 22, 2025 15:06
- Introduced `add_labels` job to add labels to issues and pull requests based on agent output.
- Updated permissions and environment variables for label handling.
- Enhanced error handling for context detection and label validation.
- Updated documentation to specify allowed labels.
@@ -260,6 +260,9 @@ output:
title-prefix: "[ai] " # Optional: prefix for PR titles
labels: [automation, ai-agent] # Optional: labels to attach to PRs
draft: true # Optional: create as draft PR (defaults to true)
labels:
allowed: [triage, bug, enhancement] # Mandatory: allowed labels for addition
Copy link
Contributor

@dsyme dsyme Aug 22, 2025

Choose a reason for hiding this comment

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

It feels like if this allowed: is not specified, then the agentic part should be able to leave the chosen labels as data.

Copy link
Contributor

Choose a reason for hiding this comment

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

This applies to all the labels: features.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll defer this to another PR.

@pelikhan pelikhan merged commit 6bacb70 into githubnext:main Aug 22, 2025
5 checks passed
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.

3 participants