Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions pkg/cli/update_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ func TestIsBranchRef(t *testing.T) {
}
}

// TestRunUpdateWorkflows_NoSourceWorkflows tests that RunUpdateWorkflows errors when no source workflows exist
// TestRunUpdateWorkflows_NoSourceWorkflows tests that RunUpdateWorkflows reports a message (not an error) when no source workflows exist
func TestRunUpdateWorkflows_NoSourceWorkflows(t *testing.T) {
tmpDir := testutil.TempDir(t, "test-*")
originalDir, _ := os.Getwd()
Expand All @@ -979,10 +979,9 @@ func TestRunUpdateWorkflows_NoSourceWorkflows(t *testing.T) {
require.NoError(t, os.MkdirAll(workflowsDir, 0755))
os.Chdir(tmpDir)

// Running update with no source workflows should fail
// Running update with no source workflows should succeed with an info message, not an error
err := RunUpdateWorkflows(nil, false, false, false, "", "", false, "", false)
require.Error(t, err, "Should error when no workflows with source field exist")
assert.Contains(t, err.Error(), "no workflows found with source field")
assert.NoError(t, err, "Should not error when no workflows with source field exist")
}

// TestRunUpdateWorkflows_SpecificWorkflowNotFound tests that RunUpdateWorkflows errors for unknown workflow name
Expand Down
3 changes: 2 additions & 1 deletion pkg/cli/update_workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ func UpdateWorkflows(workflowNames []string, allowMajor, force, verbose bool, en
if len(workflowNames) > 0 {
return errors.New("no workflows found matching the specified names with source field")
}
return errors.New("no workflows found with source field")
fmt.Fprintln(os.Stderr, console.FormatInfoMessage("no workflows found with source field"))
return nil
}

fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Found %d workflow(s) to update", len(workflows))))
Expand Down
5 changes: 5 additions & 0 deletions pkg/workflow/data/action_pins.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@
"version": "v6",
"sha": "b7c566a772e6b6bfb58ed0dc250532a479d7789f"
},
"anchore/sbom-action@v0": {
"repo": "anchore/sbom-action",
"version": "v0",
"sha": "17ae1740179002c89186b61233e0f892c3118b11"
},
Comment on lines +113 to +117
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

This change to add "anchore/sbom-action@v0" appears unrelated to the PR's stated purpose of fixing the "gh aw update" command's error handling. The PR description only mentions changes to "pkg/cli/update_workflows.go" and "pkg/cli/update_command_test.go". While this action is used in ".github/workflows/release.md", this addition should ideally be in a separate PR to keep changes focused and easier to review. If this change is intentional and related, please update the PR description to explain the connection.

Copilot uses AI. Check for mistakes.
"anchore/sbom-action@v0.22.2": {
"repo": "anchore/sbom-action",
"version": "v0.22.2",
Expand Down