Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 3
Message 1 of 9

GitHub Actions: Filter on release

Solved! Go to Solution.

Currently, on:release doesn't support any filters (for example, on:pull_request supports branches filter). Would be nice if something like following gets supported:

      - published

As a workaround, I've to do the following, which leads to one failed build and one successful build on every published release:

on: release
      - name: Cancel if not a release publish # workaround has `on` doesn't have this filter
        run: exit 1
        if: github.event.action != 'published'
      - uses: actions/checkout@v1


8 Replies
Copilot Lvl 2
Message 2 of 9

Re: GitHub Actions: Filter on release

To be relevant with webhooks (as it refers to in actions documentation), I would suggest :


      - published


Because "published", etc. are refered in an "action" node in webhooks payload.


But I totally agree with the suggestion because currently it triggers 2 runs for each release.


(Btw, thanks for the workaround)

Community Manager
Message 3 of 9

Re: GitHub Actions: Filter on release

Hi @sidvishnoi,


Thanks for this feedback! We're always working to improve GitHub, and we consider every suggestion we receive. I've logged your feature request in our internal feature request list. Though I can't guarantee anything or share a timeline for this, I can tell you that it's been shared with the appropriate teams for consideration.

Thank you for your perspective and your contribution!
All the Best

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Copilot Lvl 3
Message 4 of 9

Re: GitHub Actions: Filter on release

You can now filter the release event using types, for example:


    types: [published]


More info:

Copilot Lvl 3
Message 5 of 9

Re: GitHub Actions: Filter on release

Awesome! Can't wait to try it out!
Pilot Lvl 1
Message 6 of 9

Re: GitHub Actions: Filter on release

Are you planning on supporting additional filters?


My codebase is a large monorepo. Being able to filter based on release tag would be a huge plus.


Here's what I'm thinking about:


    types: [published, created, edited]
      - service-a
      - service-b
      - !service-xyz
      - some-other-stuff-v2.*

I hope you get the idea.

Copilot Lvl 3
Message 7 of 9

Re: GitHub Actions: Filter on release

I guess you can use the step conditionals to filter by tag value? Not sure. Sorry I'm not a GitHub support engineer.

Perhaps create a new thread?
Pilot Lvl 1
Message 8 of 9

Re: GitHub Actions: Filter on release

Filtering on the actual job and/or step is exactly what I'm doing right now. However, since I have a monorepo there are quite a few workflows that get triggered on the "release" event only to be discarded a few moments later.


Here's an example of the workflow I'm aiming for: Say I have two things (services, packages, ...) in my repository that I want to build a package of (Docker, NPM, ...), "thing-a" and "thing-b" living in their respective subfolders. When I create a release and tag it with "thing-a@v1.3.9" I want to trigger the build & publish workflow of "thing-a". I can do this with an "if" filter at the job:


type: [published]

jobs: build_and_publish: runs-on: ubuntu-latest if: github.event_name == 'release' && contains(github.ref, '/thing-a') steps: - ...


There is an identical workflow for "thing-b". Now when I publish a new release both workflows trigger. Workflow "thing-b" is then stopped at  "job.build_and_publish.if" however the triggered workflow appears in the list.


With the new filter system at the workflow overview in place I admit that this is rather an annoyance than a real issue, but since there are similar filters available for the "push" workflow trigger I thought this would make a great addition. And you are right, a new topic would probably make more sense. :)

Pilot Lvl 1
Message 9 of 9

Re: GitHub Actions: Filter on release

Does anybody know what exactly the difference is between the published, unpublished, created, edited, deleted or prereleased types?

The documentation does not details this.