Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple event-type values in the receiving job? #273

Closed
pradeipp opened this issue Oct 9, 2023 · 2 comments
Closed

Multiple event-type values in the receiving job? #273

pradeipp opened this issue Oct 9, 2023 · 2 comments

Comments

@pradeipp
Copy link

pradeipp commented Oct 9, 2023

We have a dev repo from which we want to trigger jobs in e2e test repository. We have multiple environments and with the github actions plan we've come up with we have a separate step for each environment. Each step sends a repository_dispatch trigger. That will total in about 7 triggers per step/environment.

- name: Trigger e2e-test-ch-prod
  uses: peter-evans/repository-dispatch@v2
  with:
    token: ${{ secrets.PAT }}
    repository: my-shop/e2e-tests
    event-type: test-us-prod
    client-payload: '{"ENV": "prod", "LOCALE": "US"}'

- name: Trigger e2e-test-uk-prod
  uses: peter-evans/repository-dispatch@v2
  with:
    token: ${{ secrets.PAT }}
    repository: my-shop/e2e-tests
    event-type: test-uk-prod
    client-payload: '{"ENV": "prod", "LOCALE": "UK"}'

The receiving e2e test repository will have one workflow for simple e2e tests. In the 'on' section, in the 'types' field, can we use a list like

on:
  repository_dispatch:
    types: ['test-us-prod', 'test-us-staging', 'test-uk-prod', 'test-uk-staging']

will this work?

@peter-evans
Copy link
Owner

Hi @pradeipp

The types field is an array in GitHub's spec. So I believe it will work to specify multiple types, yes.

https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#repository_dispatch

@aangelinsf
Copy link

I've got a receiving workflow that responds to two Repository Dispatch events, one coming from this action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants