If condition isn't matching release branches

Hello.

I have a github action workflow such that this is roughly what it looks like:

on: 
pull_request:
  branches:
  - dev
  - 'release/**'
  - main
jobs:
  job:
    if: |
      (github.base_ref == 'dev' || github.base_ref == 'release/**' || github.base_ref == 'main')
steps:
  # the rest of the script

I have tried every permutation of how release/** can be mentioned there, but github keeps skipping this job when I try merging a branch to a release branch.

The problem is that == is a simple equality check, not a glob operation, so it won’t match unless your branch is literally named release/**.

Why do you need the if? The pull_request.branches condition should already ensure the workflow (and its jobs) runs only if the PR is targeting one of those branches.

There are other jobs I’d include in this workflow. I want to limit the job based on branch names. But I discovered a solution to this issue using contains function. Everything would be the same as I have in the example above, but checking for release would look like this:
contains(github.base_ref, ‘release’)