Skip to content

Fix: wait-for-workflow should fail immediately when workflow does not exist#124

Merged
FidelusAleksander merged 11 commits intomainfrom
copilot/fail-workflow-action-if-does-not-exist
Mar 24, 2026
Merged

Fix: wait-for-workflow should fail immediately when workflow does not exist#124
FidelusAleksander merged 11 commits intomainfrom
copilot/fail-workflow-action-if-does-not-exist

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 19, 2026

The wait-for-workflow action did not fail immediately when given a non-existent workflow. The listWorkflowRuns GitHub API returns 200 with 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 a getWorkflow pre-flight call before the polling loop. This endpoint returns 404 reliably for non-existent workflows, allowing the action to call core.setFailed() and return immediately rather than exhausting the timeout. Also changes the default value of fail-on-timeout from false to true.
  • .github/workflows/_test-wait-for-workflow-action.yml: Adds a test workflow that:
    • Triggers only on pull_request for paths actions/wait-for-workflow/** and .github/workflows/_lint.yml
    • Uses actions/checkout@v6
    • Verifies the action fails when given a non-existent workflow ID
    • Verifies the action works correctly for an existing workflow (_lint.yml) using default timeout and polling interval, failing on timeout

Checklist

  • I have added or updated appropriate labels to this PR
  • I have tested my changes
  • I have updated the documentation if needed
Original prompt

The wait for workflow action should always fail if the workflow does not exist


💡 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.

…exist

Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
Copilot AI changed the title [WIP] Add failure condition for non-existent workflow action Fix: wait-for-workflow fails immediately when workflow does not exist Mar 19, 2026
Copilot AI requested a review from FidelusAleksander March 19, 2026 18:31
Copy link
Copy Markdown
Contributor

@FidelusAleksander FidelusAleksander left a comment

Choose a reason for hiding this comment

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

@copilot Few things

For the test workflow:

  1. Make sure you use all the latest action versions (e.g actions/checkout@v6)
  2. Trigger only on pull request, remove the push trigger
  3. Test an existing workflow as well - use the _lint.yml workflow

…workflow test

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

Copilot AI commented Mar 20, 2026

@copilot Few things

For the test workflow:...

Done in 75d7bd2:

  1. Updated to actions/checkout@v6
  2. Removed the push trigger — now only runs on pull_request
  3. Added a test-existing-workflow job that uses _lint.yml to verify the action doesn't fail for a workflow that exists

@FidelusAleksander FidelusAleksander marked this pull request as ready for review March 20, 2026 08:27
Copilot AI review requested due to automatic review settings March 20, 2026 08:27
@github-actions github-actions bot added maintenance Maintenance work on the repository actions Changes to GitHub Actions shared by this repository labels Mar 20, 2026
@FidelusAleksander
Copy link
Copy Markdown
Contributor

@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

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

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.getWorkflow call in wait-for-workflow to 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.

Copilot AI and others added 2 commits March 20, 2026 08:31
…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>
@FidelusAleksander FidelusAleksander changed the title Fix: wait-for-workflow fails immediately when workflow does not exist Fix: wait-for-workflow should fail immediately when workflow does not exist Mar 20, 2026
@FidelusAleksander FidelusAleksander requested a review from a team March 23, 2026 12:55
@FidelusAleksander FidelusAleksander removed the maintenance Maintenance work on the repository label Mar 24, 2026
@github-actions github-actions bot added the maintenance Maintenance work on the repository label Mar 24, 2026
@FidelusAleksander FidelusAleksander merged commit c07daf8 into main Mar 24, 2026
8 checks passed
@FidelusAleksander FidelusAleksander deleted the copilot/fail-workflow-action-if-does-not-exist branch March 24, 2026 08:36
@FidelusAleksander FidelusAleksander removed the maintenance Maintenance work on the repository label Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

actions Changes to GitHub Actions shared by this repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants