-
I’m trying to trigger some actions only when a branch starts with a specific pattern, but it’s not working. When I remove the filter it works, but obviously will do it on all pull requests, which I don’t want. In my case here I’d expect any branch that starts with ‘branch_name_’ will trigger the actions.
The docs here suggest this should work, unless I’m missing something. |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
We have shipped a fairly significant update to our filtering syntax for events https://help.github.com/en/articles/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet. I hope this resolves your issue. If not please let us know. |
Beta Was this translation helpful? Give feedback.
-
Works 100% better now, thanks for this update! |
Beta Was this translation helpful? Give feedback.
-
@chrispat I’m still having no luck with this. I’ve tried these patterns:
Here is an example of branch ref: refs/heads/branch_name_v1.10_foo Since the branch starts with branch_name I would expect all the patterns I’ve mentioned above to work. If I do a branch filter on only ‘*’ the actions will all run without any errors. Any ideas on what could be going wrong here? |
Beta Was this translation helpful? Give feedback.
-
I am not able to reporduce that issue. Perhaps there is some confusion about how the branches filter works in pull requests. In pull_requests you are specifying the name of the branch the pull request is targeting or the base branch. The idea is that you want to have a workflow that validates all changes that someone is trying to merge into a branch you want to protect. |
Beta Was this translation helpful? Give feedback.
-
@chrispat thanks, that makes sense. I assumed it was going work like https://github.com/actions/bin/tree/master/filter. I take it in my case I’d still need to use the branch filter action to trigger my actions if it passes, or is there another way to do this? What I’m trying to do is check if a PR has been raised with a specific branch name targeting release, if it matches the name I’m looking for, then run my actions otherwise don’t do anything. |
Beta Was this translation helpful? Give feedback.
-
At the moment there really is no good way to do that. We have some additional features planned around filtering and conditionals for workflows that should enable you to do pretty much anything you want. |
Beta Was this translation helpful? Give feedback.
-
Good to hear, thanks for the update. |
Beta Was this translation helpful? Give feedback.
-
Hi @chrispat, it looks like https://github.com/actions/bin/tree/master/filter has been removed, so now I can’t run the branch filter I was previously using. Has this functionality now been incorporated into workflow filter patterns? I can’t see anything updated in the docs to say this filter can now work on the branch I’m raising the PR with and not the branch I’m targeting with my PR. Is there anything I can use for this now? |
Beta Was this translation helpful? Give feedback.
We have shipped a fairly significant update to our filtering syntax for events https://help.github.com/en/articles/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet. I hope this resolves your issue. If not please let us know.