Fix: wait-for-workflow should fail immediately when workflow does not exist#124
Conversation
…exist Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
FidelusAleksander
left a comment
There was a problem hiding this comment.
@copilot Few things
For the test workflow:
- Make sure you use all the latest action versions (e.g actions/checkout@v6)
- Trigger only on pull request, remove the push trigger
- Test an existing workflow as well - use the _lint.yml workflow
…workflow test Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
|
@copilot In the test workflow for existing workflow (lint) you should fail on timeout, and use the default timeout duration/interval Also let's change the default setting of fail-on-timeout to true |
There was a problem hiding this comment.
Pull request overview
This PR updates the wait-for-workflow composite action to fail fast when given a workflow filename/ID that doesn’t exist, avoiding silent polling until timeout caused by listWorkflowRuns returning 200 with an empty result for unknown workflow filenames.
Changes:
- Added a pre-flight
actions.getWorkflowcall inwait-for-workflowto reliably detect non-existent workflows (404) before entering the polling loop. - Added a PR-only workflow to exercise both the non-existent-workflow failure case and an existing-workflow non-failure smoke case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| actions/wait-for-workflow/action.yml | Adds a getWorkflow pre-check to error immediately on unknown workflows. |
| .github/workflows/_test-wait-for-workflow-action.yml | Adds a CI workflow to validate the new fail-fast behavior and a basic existing-workflow path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…st to use defaults and fail on timeout Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…s with other sections
The
wait-for-workflowaction did not fail immediately when given a non-existent workflow. ThelistWorkflowRunsGitHub API returns200with an empty array for unknown workflow filenames, so the action would silently poll until timeout instead of erroring fast.Changes
actions/wait-for-workflow/action.yml: Adds agetWorkflowpre-flight call before the polling loop. This endpoint returns404reliably for non-existent workflows, allowing the action to callcore.setFailed()and return immediately rather than exhausting the timeout. Also changes the default value offail-on-timeoutfromfalsetotrue..github/workflows/_test-wait-for-workflow-action.yml: Adds a test workflow that:pull_requestfor pathsactions/wait-for-workflow/**and.github/workflows/_lint.ymlactions/checkout@v6_lint.yml) using default timeout and polling interval, failing on timeoutChecklist
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.