GitHub Actions: Filter on release #27053
-
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:
As a workaround, I’ve to do the following, which leads to one failed build and one successful build on every published release:
|
Beta Was this translation helpful? Give feedback.
Replies: 11 comments
-
To be relevant with webhooks (as it refers to in actions documentation), I would suggest :
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) |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
You can now filter the release event using types, for example:
More info: https://help.github.com/en/articles/workflow-syntax-for-github-actions#onevent_nametypes |
Beta Was this translation helpful? Give feedback.
-
Awesome! Can’t wait to try it out! |
Beta Was this translation helpful? Give feedback.
-
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:
I hope you get the idea. |
Beta Was this translation helpful? Give feedback.
-
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? |
Beta Was this translation helpful? Give feedback.
-
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:
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. :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
Does anybody know what exactly the difference is between the published, unpublished, created, edited, deleted or prereleased types? The documentation does not details this. |
Beta Was this translation helpful? Give feedback.
-
It’s not easy to find, but it’s documented here: https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/webhook-events-and-payloads#release |
Beta Was this translation helpful? Give feedback.
-
riker09:
This syntax would be awesome for monorepos! I found a way to do this by using the
|
Beta Was this translation helpful? Give feedback.
-
This is the solution we have however, it is not as good as allowing some type of filter in the on: clause as it creates builds in the actions list that start and immediately complete as opposed to not listed like actions that are skipped due to the on clause |
Beta Was this translation helpful? Give feedback.
You can now filter the release event using types, for example:
More info: https://help.github.com/en/articles/workflow-syntax-for-github-actions#onevent_nametypes