workflow-dispatch icon indicating copy to clipboard operation
workflow-dispatch copied to clipboard

Dispatch multiple workflows in one actions

Open RunsFor opened this issue 5 years ago • 2 comments

I need to trigger at least 4 parallel workflows after one particular workflow has finished. I think this action's syntax could be extended to something like this:

name: Workflow dispatch
uses: benc-uk/workflow-dispatch@v1
with:
  workflow:
    - unit
    - integration
    - ui
    - perf
  token: ${{ secrets.TOKEN }}
  ref: ${{ github.event.pull_request.head.ref }}`

This would be more cleaner way to describe such use case.

RunsFor avatar Nov 20 '20 10:11 RunsFor

Good suggestion, I think I can add this to minor version without breaking the existing behaviour

benc-uk avatar Nov 23 '20 11:11 benc-uk

I've had a similar need and I've accomplished this using the built in strategy.matrix:

    strategy:
      fail-fast: false
      matrix:
        workflow: [ 'First workflow', 'Second workflow' ]
        branch: [ 'branch1', 'branch2' ]

Your step would look like this:

      - name: Dispatch workflow run
        uses: benc-uk/workflow-dispatch@v1
        with:
          workflow: ${{ matrix.workflow }}
          token: ${{ secrets.MYTOKEN }}
          ref: ${{ matrix.branch }}

This will dispatch each workflow for each of the defined branches. The fail-fast is important in case there is an issue with one of the dispatch events. It would allow the others to complete.

desrosj avatar Feb 26 '21 19:02 desrosj

Given the time I have to maintain this action, I won't be looking at this. Sorry

benc-uk avatar Oct 28 '22 14:10 benc-uk