[Possible Bug] Workflow not executed for pushes to PR branch when base branch contains "+"

Maybe it’s just me. And I couldn’t find anything about this via search. Forgive me if I did sth wrong.

I have a GH action that should run on pushes and pull requests to a base branch named “develop+ct”.

When filtering for this branch name in on.pull_request.branches, the workflow never gets executed.
It works however using an “if” condition.

Please see More container by poikilotherm · Pull Request #20 · gdcc/dataverse · GitHub for an example.

Is this a bug, a feature or just me being not able to read docs? Thanks for helping!

The inputs for branch filters aren’t strings, they’re regular expressions (“filter patterns”) of which + is a special character.

You can use special characters in path, branch, and tag filters.

+ : Matches one or more of the preceding character.

The pattern you’ve used would match developct, developpct, developppct, developpppct etc.

A complete outline of the filter patterns is listed at the very bottom of the documentation under “Filter pattern cheat sheet” – not obvious if you’re not looking for it!

The pattern you’re looking for to match develop+ct exactly is:

develop\+ct

https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet

2 Likes

D’oh!

Hidden in plain sight. Thank you for bumping my nose into it!

Do you think it would be worse adding some notes about this? (like “take care to escape when branch names contain glob chars from the filter pattern matching”) I’d open a PR for that…

You can definitely propose such a change in the docs repo and see what the documentation team thinks:

1 Like