fix: gh aw update exits gracefully when no workflows have a source field#18433
fix: gh aw update exits gracefully when no workflows have a source field#18433
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
… (#issue) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes gh aw update to exit gracefully with an informational message when no workflows contain a source field, rather than treating this normal state as an error condition.
Changes:
- Updated error handling to display an info message when no updatable workflows exist (general case)
- Preserved error behavior when specific workflow names are requested but not found
- Updated unit test to verify the new graceful exit behavior
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/cli/update_workflows.go | Changed from returning an error to printing an info message and returning nil when no workflows with source field exist (general case) |
| pkg/cli/update_command_test.go | Updated test assertion from expecting an error to expecting success when no source workflows exist |
| pkg/workflow/data/action_pins.json | Added pin for anchore/sbom-action@v0 (appears unrelated to the PR's stated purpose) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "anchore/sbom-action@v0": { | ||
| "repo": "anchore/sbom-action", | ||
| "version": "v0", | ||
| "sha": "17ae1740179002c89186b61233e0f892c3118b11" | ||
| }, |
There was a problem hiding this comment.
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.
gh aw updatewas failing with an error when run in a repo where no workflows contain asourcefield. Having no updatable workflows is a normal state, not an error condition.Changes
pkg/cli/update_workflows.go: Replace theerrors.New("no workflows found with source field")return with an info message (ℹ no workflows found with source field) andnilreturn. When specific workflow names are requested but not found, the error path is preserved.pkg/cli/update_command_test.go: UpdatedTestRunUpdateWorkflows_NoSourceWorkflowsto assertNoErrorinstead of the now-removed error message.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/graphql/usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GO111MODULE 64/bin/go git conf�� user.name Test User /opt/hostedtoolcache/node/24.13.1/x64/bin/node rXVX/lLf3_NsTwlBgit GO111MODULE 64/bin/go node(http block)/usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git(http block)https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha ithub-script/git/ref/tags/v8 GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet env -json GO111MODULE /tmp/go-build3685685313/b393/envutil.test GOINSECURE GOMOD GOMODCACHE /tmp/go-build3685685313/b393/envutil.test(http block)/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha --show-toplevel /tmp/go-build368-10 /usr/bin/git -test.paniconexigit -test.v=true /usr/bin/git git rev-�� --show-toplevel git 1355626/b389/vet.cfg --show-toplevel 9937926/b399/imprev-parse /usr/bin/git git(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v3/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --show-toplevel go /usr/bin/git runs/20260226-02git GO111MODULE 1/x64/bin/node git chec�� -b feature-branch /usr/bin/git ithub/workflows/git GO111MODULE 64/pkg/tool/linu--show-toplevel git(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha vaScript561532602/001/test-frontmatter-with-nested-objects.md GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env runs/20260226-024829-28877/test-1017465826/.github/workflows .cfg 5685313/b373/vet.cfg GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha /tmp/gh-aw-test-runs/20260226-024829-28877/test-1230261687 rev-parse /usr/bin/git @{u} k/gh-aw/gh-aw/pkrev-parse 64/bin/go git conf�� user.name Test User /opt/hostedtoolcache/node/24.13.1/x64/bin/node ub/workflows -trimpath 64/bin/go node(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v5/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha 691331002/.github/workflows GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha 5685313/b422/testutil.test -buildtags 5685313/b422/importcfg.link -errorsas -ifaceassert -nilfunc 7JbrieQ94-F8q/4N_hV3O2Cg4KalLpCxFj/loOf-cgjR6MKz0XVD7GS/mRL0tEU7JbrieQ94-F8q -C ry=1 config 5685313/b422/_pkg_.a remote.origin.urgit GO111MODULE 64/bin/go git(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel node /usr/bin/git --check scripts/**/*.js 64/bin/go git rev-�� --show-toplevel go /opt/hostedtoolcache/node/24.13.1/x64/bin/node -json GO111MODULE 64/bin/go /opt/hostedtoolcache/node/24.13.1/x64/bin/node(http block)https://api.github.com/repos/actions/github-script/git/ref/tags/v8/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE erignore m/_n�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha go1.25.0 -c=4 -nolocalimports -importcfg /tmp/go-build3685685313/b390/importcfg -pack /tmp/go-build3685685313/b390/_testmain.go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha ck 'scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh(http block)https://api.github.com/repos/actions/setup-go/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha /v1.0.0 git /usr/bin/git /home/REDACTED/worgit(http block)https://api.github.com/repos/actions/setup-node/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha -json GO111MODULE 1/x64/bin/node GOINSECURE GOMOD GOMODCACHE go t-ha�� SameOutput2345773779/001/stability-test.md GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel -dwarf=false ache/node/24.13.--show-toplevel git rev-�� --show-toplevel git /usr/bin/gh k/gh-aw/gh-aw/.ggit /tmp/go-build368rev-parse /usr/bin/git gh(http block)https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts/usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 1 --dir test-logs/run-1 ache/go/1.25.0/x64/pkg/tool/linux_amd64/link /usr/bin/git 5685313/b407/pargit GO111MODULE .cfg git conf�� user.email test@example.com /usr/bin/git ry=1 GO111MODULE 5685313/b407/_pk--show-toplevel git(http block)https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts/usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 12345 --dir test-logs/run-12345 go /usr/bin/git -json GO111MODULE /opt/hostedtoolc--show-toplevel git diff�� --stat f781b8a531ef99b9c3fc83bba4625701ec34cc71..HEAD /usr/bin/git :latest GO111MODULE 1/x64/bin/node git(http block)https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts/usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 12346 --dir test-logs/run-12346 go /usr/bin/git XQQB/tRuxqCKga2Pgit GO111MODULE /opt/hostedtoolc--show-toplevel git bran�� --show-current 5685313/b399/importcfg /usr/bin/git k/gh-aw/gh-aw/pkgit k/gh-aw/gh-aw/pkrev-parse 1/x64/bin/node git(http block)https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts/usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 2 --dir test-logs/run-2 go At,event,headBranch,headSha,displayTitle orts3476263993/0git GO111MODULE /opt/hostedtoolc--show-toplevel git conf�� user.name Test User /usr/bin/git r-test2525111494git r-test2525111494rev-parse /usr/bin/git git(http block)https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts/usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 3 --dir test-logs/run-3 go /usr/bin/git -json GO111MODULE /opt/hostedtoolc--show-toplevel git add . go /usr/bin/git -json GO111MODULE /opt/hostedtoolcxterm-color git(http block)https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts/usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env ty-test.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 4 --dir test-logs/run-4 V_9LLtYheNxUI/rcVLHjwofsbGz_Wa5yJE/ljgChBZHiD7Wn-tests /usr/bin/git ry=1 GO111MODULE 5685313/b411/_pk--show-toplevel git comm�� -m Initial /usr/bin/git -json GO111MODULE /usr/bin/gh git(http block)https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts/usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 5 --dir test-logs/run-5 go /usr/lib/git-core/git -json l /opt/hostedtoolc--show-toplevel /usr/lib/git-core/git main�� run --auto /usr/bin/git --detach GO111MODULE /tmp/go-build368--show-toplevel git(http block)https://api.github.com/repos/github/gh-aw/actions/workflows/usr/bin/gh gh workflow list --json name,state,path GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 9937926/b382/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE bagabas/go-udiffenv GOMODCACHE go(http block)/usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 GOMOD GOMODCACHE go env l9Bz/SUU0Yf-ttQmGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 9937926/b390/impGOPROXY(http block)/usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 6 GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha matter-with-arrays.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel go /usr/bin/git 1643698334/.githgit GO111MODULE 64/bin/go git rev-�� --show-toplevel go(http block)https://api.github.com/repos/nonexistent/action/git/ref/tags/v999.999.999/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE Mg/WeGoJ5R4ikM6s7pdmN96/PotExI9S0aYgU9eINNKU env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha gh-aw/actions/setup/sh/sanitize_path.sh' '/usr/bin:::/usr/local/bin' && echo "$PATH" go /usr/bin/git 3894084937/.githbash GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE 64/pkg/tool/linu/tmp/gh-aw-test-runs/20260226-025010-32851/test-2688151625/.github/workflows git(http block)https://api.github.com/repos/nonexistent/repo/actions/runs/12345/usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE x_amd64/vet env ty-test.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion -json GO111MODULE epo.git 64/pkg/tool/linux_amd64/link rev-�� HEAD gcc /usr/bin/git -x c /usr/bin/git git(http block)https://api.github.com/repos/owner/repo/actions/workflows/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 9937926/b383/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE bagabas/go-udiffenv GOMODCACHE go(http block)/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo /usr/bin/git -json GO111MODULE 64/bin/go git 1/x6�� --show-toplevel 51RFpkM/58sERvdotCvyK1taGOl6 /usr/bin/git -json GO111MODULE 64/bin/go git(http block)https://api.github.com/repos/owner/repo/contents/file.md/tmp/go-build3685685313/b381/cli.test /tmp/go-build3685685313/b381/cli.test -test.testlogfile=/tmp/go-build3685685313/b381/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go env ck 'scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/tmp/go-build3121355626/b381/cli.test /tmp/go-build3121355626/b381/cli.test -test.testlogfile=/tmp/go-build3121355626/b381/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true test-logs/run-3 GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE 64/bin/go git(http block)https://api.github.com/repos/test-owner/test-repo/actions/secrets/usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name --show-toplevel go /usr/bin/git -json GO111MODULE x_amd64/link git 1/x6�� --show-toplevel x_amd64/link /usr/bin/git -json GO111MODULE 64/bin/go git(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.