actions / actions/runner

workflow_run event with types:[completed] triggers before workflow actually completes

Open
#4,035 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Stale
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:

  1. Once immediately after the referenced workflow starts (incorrect)
  2. Once after the referenced workflow completes (correct)

Reproduction Steps

  1. Create a workflow that triggers on workflow_run:
name: Deploy
on:
  workflow_run:
    workflows: ["CI/CD Pipeline"]
    types: [completed]
    branches: [develop]
  1. Push code to trigger the CI/CD Pipeline workflow
  2. Observe that the Deploy workflow triggers immediately (within seconds) while CI is still running
  3. The Deploy workflow correctly skips because github.event.workflow_run.conclusion is not 'success'
  4. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.