The events push|pull_request have support for extended filtering on branches/tags and paths. I need similar filters for other events like deployment or release.
on: release: types: [published] ref: - '*/foo' - 'bar-*'
This will only trigger for published releases, that have a Git ref value
on: deployment: payload: - service_name: 'foobar'
This example will only trigger on a deployment event with a payload key service_name which has a value foobar.
My codebase is a rather large monorepo with 20+ different services. Without any filtering anytime I trigger the deployment event all workflow files are being executed. I filter stop the job by filtering with an if conditional:
on: deployment: jobs: deploy: runs-on: ubuntu-latest steps: - if: github.event.deployment.payload.service_name == 'foobar' uses: ./.github/actions/deploy with: service_name: 'foobar'
I could put the logic that determines which service to deploy into my custom deploy action, yes. That would still leave me with 20+ workflow runs when in reality only one service is deployed.