Search code examples
github-actions

Run a workflow when multiple other workflows have finished in github actions


For example in my repository I have 3 github action workflows: linting(L), unittests(U) and also build(B) workflow which I want to trigger only when L and U are done. Both L and U trigger automatically on a push event. If I do this in B workflow:

  workflow_run:
    workflows: ["Lint", "UnitTests"]
    types: 
      - completed

I get my build workflow triggered twice, first time when L finishes and second time when U finishes. Is it possible to trigger B only once when both L and U have finished?


Solution

  • This is not possible out of the box. It works like OR here. If you want to trigger this workflows only when both workflow finished you need to introduce some kind of orchestrator here which will store state and keep information about already executed workflows. It could be some stateful app. However, this is huge effort.