Add target field support to add-labels safe output#1142
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] add-labels target not supported
Add target field support to add-labels safe output
Oct 2, 2025
pelikhan
approved these changes
Oct 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes issue where the
targetfield was not supported foradd-labelssafe output, unlikeadd-commentwhich already had this functionality.Problem
The
add-labelssafe output configuration was missing support for thetargetfield, which meant labels could only be added to the triggering issue/PR. The Go code already parsed and passed thetargetconfiguration via environment variables, but the JavaScript/TypeScript implementation didn't consume it.Solution
This PR completes the implementation by adding target field support to the JavaScript/TypeScript code, bringing
add-labelsto feature parity withadd-comment.The
targetfield now supports three modes:"triggering"(default): Adds labels to the triggering issue/PR"*": Allows adding labels to any issue by specifyingissue_numberin the agent output"123"): Adds labels to a specific issue numberUsage Example
With this configuration, the agent can add labels to multiple issues in a single workflow run by including
issue_numberin the output:Changes
pkg/workflow/js/add_labels.tsto read and useGITHUB_AW_LABELS_TARGETenvironment variableadd-commentimplementationdocs/src/content/docs/reference/safe-outputs.mdTesting
All tests pass including:
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.