workflow_run event with types:[completed] triggers before workflow actually completes
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 1.4k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 24
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.conclusionis 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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the workflow_run configuration from the issue in amalc/launcher and compare the referenced workflow's start and completion timestamps with both triggered runs. Trace the workflow_run event handling entry point in the runner repository, then verify that types: [completed] produces only one run after completion and preserves the documented conclusion value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, github-actions
- Domain
- ci-cd
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100