Skip to content
clock

GitHub Action

Workflow Run Wait

v1.4.4 Latest version

Workflow Run Wait

clock

Workflow Run Wait

wait for all `workflow_run` required workflows to be successful

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Workflow Run Wait

uses: ahmadnassri/[email protected]

Learn more about this action in ahmadnassri/action-workflow-run-wait

Choose a version

GitHub Action: Workflow Run Wait

wait for all workflow_run required workflows to be successful

license release super linter test semantic

Why?

The workflow_run event occurs when a workflow run is requested or completed, and allows you to execute a workflow based on the finished result of another workflow.

example
on:
workflow_run:
  workflows: [ test ]
  types: 
    - completed

However by itself, this doesn't quite work as expected.

  1. The completed type, does not indicate success, for that you'd have to include the following in each job of your workflow:

    if: ${{ github.event.workflow_run.conclusion == 'success' }}
  2. If you're depending on more than one workflow, then ANY of them completing, will trigger the event

    example
    name: deploy
    
    on:
    workflow_run:
      workflows: [ test, lint, compile ]
      types: 
        - completed

    if your test workflow fails, but lint completed successfully, github.event.workflow_run.conclusion == 'success' will still be true

  3. Your workflow will trigger as many times as you have workflow dependencies

    > _in the previous example, our `deploy` workflow, will run 3 times!_
    

    All this makes the workflow_run event fundamentally broken for any advanced usage, this Action aims to remedy that.

    Note: See this Community discussion for more info on the topic

Usage

on:
  workflow_run:
    workflows: [ test-client, test-server ]
    branches: [ master ]
    types: [ completed ]

jobs:
  xyz:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - uses: ahmadnassri/action-workflow-run-wait@v1

      # only runs additional steps if [ test-client, test-server ] were successful

Inputs

input required default description
github-token github.token The GitHub token used to call the GitHub API
timeout 30000 timeout before we stop trying (in milliseconds)
delay 5000 delay between status checks (in milliseconds)
sha github.sha Git SHA, if it's different from github.sha
ignore-cancelled false ignore cancelled workflow runs

Author: Ahmad Nassri • Twitter: @AhmadNassri