From 38e85652196b10e9a478378ddebccf8f8be0b20c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 13:06:12 +0000 Subject: [PATCH 1/4] Initial plan From 57bd4b9513921177bea5ab686fc3f48aab7c4a7d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 13:14:29 +0000 Subject: [PATCH 2/4] Add --repo flag to status command Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com> --- pkg/cli/commands_test.go | 6 +++--- pkg/cli/status.go | 15 +++++++++------ pkg/cli/status_command.go | 15 +++++++++------ pkg/cli/status_command_test.go | 4 ++-- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/pkg/cli/commands_test.go b/pkg/cli/commands_test.go index 63a80bda5f..7e7a451636 100644 --- a/pkg/cli/commands_test.go +++ b/pkg/cli/commands_test.go @@ -219,7 +219,7 @@ func TestRemoveWorkflows(t *testing.T) { } func TestStatusWorkflows(t *testing.T) { - err := StatusWorkflows("test-pattern", false, false, "", "") + err := StatusWorkflows("test-pattern", false, false, "", "", "") // Should not error since it's a stub implementation if err != nil { @@ -421,8 +421,8 @@ Test workflow for command existence.` _, err := CompileWorkflows(config) return err }, false, "CompileWorkflows"}, - {func() error { return RemoveWorkflows("nonexistent", false) }, false, "RemoveWorkflows"}, // Should handle missing directory gracefully - {func() error { return StatusWorkflows("nonexistent", false, false, "", "") }, false, "StatusWorkflows"}, // Should handle missing directory gracefully + {func() error { return RemoveWorkflows("nonexistent", false) }, false, "RemoveWorkflows"}, // Should handle missing directory gracefully + {func() error { return StatusWorkflows("nonexistent", false, false, "", "", "") }, false, "StatusWorkflows"}, // Should handle missing directory gracefully {func() error { return EnableWorkflows("nonexistent") }, true, "EnableWorkflows"}, // Should now error when no workflows found to enable {func() error { return DisableWorkflows("nonexistent") }, true, "DisableWorkflows"}, // Should now also error when no workflows found to disable {func() error { diff --git a/pkg/cli/status.go b/pkg/cli/status.go index 4e70b52f32..93b91f5f3d 100644 --- a/pkg/cli/status.go +++ b/pkg/cli/status.go @@ -18,11 +18,12 @@ and time remaining until expiration (if stop-after is configured). The optional pattern argument filters workflows by name (case-insensitive substring match). Examples: - ` + constants.CLIExtensionPrefix + ` status # Show all workflow status - ` + constants.CLIExtensionPrefix + ` status ci- # Show workflows with 'ci-' in name - ` + constants.CLIExtensionPrefix + ` status --json # Output in JSON format - ` + constants.CLIExtensionPrefix + ` status --ref main # Show latest run status for main branch - ` + constants.CLIExtensionPrefix + ` status --label automation # Show workflows with 'automation' label`, + ` + constants.CLIExtensionPrefix + ` status # Show all workflow status + ` + constants.CLIExtensionPrefix + ` status ci- # Show workflows with 'ci-' in name + ` + constants.CLIExtensionPrefix + ` status --json # Output in JSON format + ` + constants.CLIExtensionPrefix + ` status --ref main # Show latest run status for main branch + ` + constants.CLIExtensionPrefix + ` status --label automation # Show workflows with 'automation' label + ` + constants.CLIExtensionPrefix + ` status --repo owner/other-repo # Check status in different repository`, RunE: func(cmd *cobra.Command, args []string) error { var pattern string if len(args) > 0 { @@ -32,11 +33,13 @@ Examples: jsonFlag, _ := cmd.Flags().GetBool("json") ref, _ := cmd.Flags().GetString("ref") labelFilter, _ := cmd.Flags().GetString("label") - return StatusWorkflows(pattern, verbose, jsonFlag, ref, labelFilter) + repoOverride, _ := cmd.Flags().GetString("repo") + return StatusWorkflows(pattern, verbose, jsonFlag, ref, labelFilter, repoOverride) }, } addJSONFlag(cmd) + cmd.Flags().StringP("repo", "r", "", "Target repository (owner/repo format). Defaults to current repository") cmd.Flags().String("ref", "", "Filter runs by branch or tag name (e.g., main, v1.0.0)") cmd.Flags().String("label", "", "Filter workflows by label") diff --git a/pkg/cli/status_command.go b/pkg/cli/status_command.go index 035a4bdcff..b42ec2440c 100644 --- a/pkg/cli/status_command.go +++ b/pkg/cli/status_command.go @@ -30,8 +30,8 @@ type WorkflowStatus struct { RunConclusion string `json:"run_conclusion,omitempty" console:"header:Run Conclusion,omitempty"` } -func StatusWorkflows(pattern string, verbose bool, jsonOutput bool, ref string, labelFilter string) error { - statusLog.Printf("Checking workflow status: pattern=%s, jsonOutput=%v, ref=%s, labelFilter=%s", pattern, jsonOutput, ref, labelFilter) +func StatusWorkflows(pattern string, verbose bool, jsonOutput bool, ref string, labelFilter string, repoOverride string) error { + statusLog.Printf("Checking workflow status: pattern=%s, jsonOutput=%v, ref=%s, labelFilter=%s, repo=%s", pattern, jsonOutput, ref, labelFilter, repoOverride) if verbose && !jsonOutput { fmt.Printf("Checking status of workflow files\n") if pattern != "" { @@ -66,7 +66,7 @@ func StatusWorkflows(pattern string, verbose bool, jsonOutput bool, ref string, // Get GitHub workflows data statusLog.Print("Fetching GitHub workflow status") - githubWorkflows, err := fetchGitHubWorkflows("", verbose && !jsonOutput) + githubWorkflows, err := fetchGitHubWorkflows(repoOverride, verbose && !jsonOutput) if err != nil { statusLog.Printf("Failed to fetch GitHub workflows: %v", err) if verbose && !jsonOutput { @@ -89,7 +89,7 @@ func StatusWorkflows(pattern string, verbose bool, jsonOutput bool, ref string, if verbose && !jsonOutput { fmt.Printf("Fetching latest runs for ref: %s\n", ref) } - latestRunsByWorkflow, err = fetchLatestRunsByRef(ref, verbose && !jsonOutput) + latestRunsByWorkflow, err = fetchLatestRunsByRef(ref, repoOverride, verbose && !jsonOutput) if err != nil { statusLog.Printf("Failed to fetch workflow runs for ref %s: %v", ref, err) if verbose && !jsonOutput { @@ -454,8 +454,8 @@ func extractEngineIDFromFile(filePath string) string { } // fetchLatestRunsByRef fetches the latest workflow run for each workflow from a specific ref (branch or tag) -func fetchLatestRunsByRef(ref string, verbose bool) (map[string]*WorkflowRun, error) { - statusLog.Printf("Fetching latest workflow runs for ref: %s", ref) +func fetchLatestRunsByRef(ref string, repoOverride string, verbose bool) (map[string]*WorkflowRun, error) { + statusLog.Printf("Fetching latest workflow runs for ref: %s, repo: %s", ref, repoOverride) // Start spinner for network operation (only if not in verbose mode) spinner := console.NewSpinner("Fetching workflow runs for ref...") @@ -465,6 +465,9 @@ func fetchLatestRunsByRef(ref string, verbose bool) (map[string]*WorkflowRun, er // Fetch workflow runs for the ref (uses --branch flag which also works for tags) args := []string{"run", "list", "--branch", ref, "--json", "databaseId,number,url,status,conclusion,workflowName,createdAt,headBranch", "--limit", "100"} + if repoOverride != "" { + args = append(args, "--repo", repoOverride) + } cmd := workflow.ExecGH(args...) output, err := cmd.Output() diff --git a/pkg/cli/status_command_test.go b/pkg/cli/status_command_test.go index b46ea2900e..cdb986af46 100644 --- a/pkg/cli/status_command_test.go +++ b/pkg/cli/status_command_test.go @@ -28,7 +28,7 @@ func TestStatusWorkflows_JSONOutput(t *testing.T) { // Test JSON output without pattern t.Run("JSON output without pattern", func(t *testing.T) { - err := StatusWorkflows("", false, true, "", "") + err := StatusWorkflows("", false, true, "", "", "") if err != nil { t.Errorf("StatusWorkflows with JSON flag failed: %v", err) } @@ -38,7 +38,7 @@ func TestStatusWorkflows_JSONOutput(t *testing.T) { // Test JSON output with pattern t.Run("JSON output with pattern", func(t *testing.T) { - err := StatusWorkflows("smoke", false, true, "", "") + err := StatusWorkflows("smoke", false, true, "", "", "") if err != nil { t.Errorf("StatusWorkflows with JSON flag and pattern failed: %v", err) } From 67c9abf51ced974c32894c60e8a5f96bb4f81edf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 13:17:51 +0000 Subject: [PATCH 3/4] Add test for --repo flag functionality Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com> --- .github/workflows/issue-classifier.lock.yml | 2 +- .github/workflows/release.lock.yml | 6 +++--- .github/workflows/stale-repo-identifier.lock.yml | 2 +- .github/workflows/super-linter.lock.yml | 2 +- pkg/cli/status_command_test.go | 16 ++++++++++++++++ 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/issue-classifier.lock.yml b/.github/workflows/issue-classifier.lock.yml index 02134fb672..44eafee6c7 100644 --- a/.github/workflows/issue-classifier.lock.yml +++ b/.github/workflows/issue-classifier.lock.yml @@ -2204,7 +2204,7 @@ jobs: path: /tmp/gh-aw/aw_info.json if-no-files-found: warn - name: Run AI Inference - uses: actions/ai-inference@334892bb203895caaed82ec52d23c1ed9385151e # v1 + uses: actions/ai-inference@334892bb203895caaed82ec52d23c1ed9385151e # v2.0.4 env: GH_AW_MCP_CONFIG: /tmp/gh-aw/mcp-config/mcp-servers.json GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/release.lock.yml b/.github/workflows/release.lock.yml index 0be3614def..658d3b9a1d 100644 --- a/.github/workflows/release.lock.yml +++ b/.github/workflows/release.lock.yml @@ -6017,13 +6017,13 @@ jobs: - name: Download Go modules run: go mod download - name: Generate SBOM (SPDX format) - uses: anchore/sbom-action@43a17d6e7add2b5535efe4dcae9952337c479a93 # v0.20.10 + uses: anchore/sbom-action@43a17d6e7add2b5535efe4dcae9952337c479a93 # v0.20.11 with: artifact-name: sbom.spdx.json format: spdx-json output-file: sbom.spdx.json - name: Generate SBOM (CycloneDX format) - uses: anchore/sbom-action@43a17d6e7add2b5535efe4dcae9952337c479a93 # v0.20.10 + uses: anchore/sbom-action@43a17d6e7add2b5535efe4dcae9952337c479a93 # v0.20.11 with: artifact-name: sbom.cdx.json format: cyclonedx-json @@ -6227,7 +6227,7 @@ jobs: fetch-depth: 0 persist-credentials: false - name: Release with gh-extension-precompile - uses: cli/gh-extension-precompile@9e2237c30f869ad3bcaed6a4be2cd43564dd421b # v2 + uses: cli/gh-extension-precompile@9e2237c30f869ad3bcaed6a4be2cd43564dd421b # v2.1.0 with: build_script_override: scripts/build-release.sh go_version_file: go.mod diff --git a/.github/workflows/stale-repo-identifier.lock.yml b/.github/workflows/stale-repo-identifier.lock.yml index eee179e885..144161022a 100644 --- a/.github/workflows/stale-repo-identifier.lock.yml +++ b/.github/workflows/stale-repo-identifier.lock.yml @@ -174,7 +174,7 @@ jobs: ORGANIZATION: ${{ env.ORGANIZATION }} id: stale-repos name: Run stale_repos tool - uses: github/stale-repos@a21e55567b83cf3c3f3f9085d3038dc6cee02598 # v3 + uses: github/stale-repos@a21e55567b83cf3c3f3f9085d3038dc6cee02598 # v3.0.2 - env: INACTIVE_REPOS: ${{ steps.stale-repos.outputs.inactiveRepos }} name: Save stale repos output diff --git a/.github/workflows/super-linter.lock.yml b/.github/workflows/super-linter.lock.yml index 4d0e7e71fe..5207834200 100644 --- a/.github/workflows/super-linter.lock.yml +++ b/.github/workflows/super-linter.lock.yml @@ -6146,7 +6146,7 @@ jobs: persist-credentials: false - name: Super-linter id: super-linter - uses: super-linter/super-linter@47984f49b4e87383eed97890fe2dca6063bbd9c3 # v8.2.1 + uses: super-linter/super-linter@47984f49b4e87383eed97890fe2dca6063bbd9c3 # v8.3.1 env: CREATE_LOG_FILE: "true" DEFAULT_BRANCH: main diff --git a/pkg/cli/status_command_test.go b/pkg/cli/status_command_test.go index cdb986af46..771403697d 100644 --- a/pkg/cli/status_command_test.go +++ b/pkg/cli/status_command_test.go @@ -513,3 +513,19 @@ func TestWorkflowStatus_ConsoleRenderingWithRunStatus(t *testing.T) { } } } + +// TestStatusWorkflows_WithRepoOverride tests that the repoOverride parameter is accepted +func TestStatusWorkflows_WithRepoOverride(t *testing.T) { + // This test verifies that the function accepts the repoOverride parameter + // and doesn't error out. It should work in the current repository context. + err := StatusWorkflows("", false, true, "", "", "") + if err != nil { + t.Errorf("StatusWorkflows with empty repoOverride should not error: %v", err) + } + + // Test with a non-empty repo override (will fail gracefully if repo doesn't exist) + // We expect this to either succeed or fail gracefully without panicking + _ = StatusWorkflows("", false, true, "", "", "nonexistent/repo") + // Note: We don't check error here because it's expected to fail for a nonexistent repo + // The important part is that the parameter is accepted and used +} From 0ed501686390dbeb224da1be32742acf15a7ee2d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 13:20:46 +0000 Subject: [PATCH 4/4] Complete implementation of --repo flag for status command Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com> --- pkg/cli/commands_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/cli/commands_test.go b/pkg/cli/commands_test.go index 7e7a451636..5a436d48d6 100644 --- a/pkg/cli/commands_test.go +++ b/pkg/cli/commands_test.go @@ -421,10 +421,10 @@ Test workflow for command existence.` _, err := CompileWorkflows(config) return err }, false, "CompileWorkflows"}, - {func() error { return RemoveWorkflows("nonexistent", false) }, false, "RemoveWorkflows"}, // Should handle missing directory gracefully + {func() error { return RemoveWorkflows("nonexistent", false) }, false, "RemoveWorkflows"}, // Should handle missing directory gracefully {func() error { return StatusWorkflows("nonexistent", false, false, "", "", "") }, false, "StatusWorkflows"}, // Should handle missing directory gracefully - {func() error { return EnableWorkflows("nonexistent") }, true, "EnableWorkflows"}, // Should now error when no workflows found to enable - {func() error { return DisableWorkflows("nonexistent") }, true, "DisableWorkflows"}, // Should now also error when no workflows found to disable + {func() error { return EnableWorkflows("nonexistent") }, true, "EnableWorkflows"}, // Should now error when no workflows found to enable + {func() error { return DisableWorkflows("nonexistent") }, true, "DisableWorkflows"}, // Should now also error when no workflows found to disable {func() error { return RunWorkflowOnGitHub("", false, "", "", "", false, false, false, []string{}, false) }, true, "RunWorkflowOnGitHub"}, // Should error with empty workflow name