Filter entire workflow instead of per-job

I have a workflow that I use for generating a github release. The workflow has several jobs (most of which are reused by my build-and-test workflow).

I have a pretty large regex tag filter defined on the last job of the workflow. However, unless I propagate that regex to all the jobs in the workflow, those other jobs also run on pull requests, which is wasteful because that’s what my other workflow is for.

My question is: can I define a filter at the workflow level instead of job level? If not, is there a way to define that regex pattern once and reuse it across those jobs?

release:
  jobs:
  - job-one
  - job-two:
      requires:
        - job-one
  - publish-release:
      requires:
        - job-two
      filters:
        branches:
          ignore: /.*/
        tags:
          only: {really long regex pattern}

At this time it’s not possible to apply a filter at the workflow level. This is an appropriate time to make use of some yaml aliases in the config. You can see another example of the usage here.

Thanks for pointing me to the alias map. I’ll give that a try!

Edit: worked like a charm.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.