-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Bug Description
The workflow_run
event with types: [completed]
is incorrectly triggering BEFORE the referenced workflow actually completes, in addition to the correct trigger after completion.
Expected Behavior
According to GitHub Actions documentation, workflow_run
with types: [completed]
should only trigger AFTER the referenced workflow finishes running.
Actual Behavior
The workflow_run
event triggers TWICE:
- Once immediately after the referenced workflow starts (incorrect)
- Once after the referenced workflow completes (correct)
Reproduction Steps
- Create a workflow that triggers on
workflow_run
:
name: Deploy
on:
workflow_run:
workflows: ["CI/CD Pipeline"]
types: [completed]
branches: [develop]
- Push code to trigger the CI/CD Pipeline workflow
- Observe that the Deploy workflow triggers immediately (within seconds) while CI is still running
- The Deploy workflow correctly skips because
github.event.workflow_run.conclusion
is not 'success' - Several minutes later, when CI completes, the Deploy workflow triggers again (correctly)
Evidence
Repository: amalc/launcher
Example sequence on 2025-09-10:
- CI/CD Pipeline started at 22:57:02 UTC (run ID: 17628907096)
- Deploy workflow triggered at 22:57:14 UTC (run ID: 17628910540) - INCORRECT, CI still running, correctly skipped
- CI/CD Pipeline completed successfully ~6 minutes later
- Deploy workflow triggered again at 23:03:57 UTC (run ID: 17629021343) - CORRECT, after CI completed
Impact
- Creates confusing "skipped" workflow runs in the Actions tab
- Wastes GitHub Actions minutes checking conditions unnecessarily
- Makes debugging deployment issues more difficult
- Could cause race conditions if the condition check is not properly implemented
- Clutters the Actions history with duplicate runs
Current Workaround
We check github.event.workflow_run.conclusion == 'success'
which correctly skips premature triggers, but this shouldn't be necessary if the event only fired after completion as documented.
Environment
- Repository type: Public repository
- Workflow trigger: workflow_run with types: [completed]
- Affected branches: All branches specified in workflow_run trigger
- Runner: GitHub-hosted runners
Related Issues
This may be related to event queuing or race conditions in the GitHub Actions event dispatcher.
Please fix the workflow_run
event to only trigger after the referenced workflow actually completes, matching the documented behavior.