Skip to content

Include label_command labels in create_labels label collection#31159

Merged
pelikhan merged 2 commits intomainfrom
copilot/ensure-label-command-collecting-labels
May 9, 2026
Merged

Include label_command labels in create_labels label collection#31159
pelikhan merged 2 commits intomainfrom
copilot/ensure-label-command-collecting-labels

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 9, 2026

  • Merge origin/main into this branch
  • Run make recompile
  • Verify no additional file changes remain after recompile
  • Reply to the PR comment with the commit hash

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Include label_command labels in create_labels admin command Include label_command labels in create_labels label collection May 9, 2026
Copilot AI requested a review from pelikhan May 9, 2026 04:59
@pelikhan pelikhan marked this pull request as ready for review May 9, 2026 05:03
Copilot AI review requested due to automatic review settings May 9, 2026 05:03
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

Fixes create_labels label discovery by expanding compile-time JSON label aggregation to include on.label_command trigger labels, preventing missing-label scenarios during admin label creation.

Changes:

  • Expanded extractSafeOutputLabels to collect labels from WorkflowData.LabelCommand in addition to safe-outputs label sources.
  • Adjusted nil-handling so label extraction still works when SafeOutputs is absent.
  • Added unit tests for inclusion and cross-source deduplication behavior.
Show a summary per file
File Description
pkg/cli/compile_workflow_processor.go Extends label aggregation to include label_command labels and updates related comments/nil-handling.
pkg/cli/compile_workflow_processor_test.go Adds unit tests validating inclusion of label_command labels and deduplication across sources.

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)

pkg/cli/compile_workflow_processor_test.go:13

  • The primary bug scenario described in the PR is workflows that use on.label_command but have no safe-outputs config (i.e., SafeOutputs is nil). The current tests only cover cases where SafeOutputs is non-nil. Add a test that sets SafeOutputs: nil and LabelCommand: []string{"deploy"} and asserts the label is still returned.
func TestExtractSafeOutputLabels_IncludesLabelCommand(t *testing.T) {
	data := &workflow.WorkflowData{
		SafeOutputs: &workflow.SafeOutputsConfig{
			CreateIssues: &workflow.CreateIssuesConfig{
				Labels:        []string{"bug"},
  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment on lines +1 to +2
package cli

Comment on lines +158 to 162
// extractSafeOutputLabels collects all unique labels referenced by workflow configuration
// that should exist in the repository for the workflow to function correctly.
// Scans: safe-outputs labels (create-issue/create-discussion/create-pull-request/add-labels)
// and on.label_command trigger labels.
func extractSafeOutputLabels(data *workflow.WorkflowData) []string {
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented May 9, 2026

@copilot Merge main and recompile

…command-collecting-labels

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 9, 2026

@copilot Merge main and recompile

Done in 4e73efa890: merged origin/main into this branch and ran make recompile.

@pelikhan pelikhan merged commit ea0d783 into main May 9, 2026
@pelikhan pelikhan deleted the copilot/ensure-label-command-collecting-labels branch May 9, 2026 05:20
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