GitHub Actions triggered for branch that doesn't meet the criteria

I want to do some actions only if there’s a new branch that was created with release/ or hotfix/ prefix. This is what I came up with:

name: Release Branch created
on:
  create:
    branches:
      - 'release/**'
- 'hotfix/**'
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    steps:
      - name: Do stuff

This doesn’t work as intended. this job is triggerred for random branch names like test/hello. Any idea why?

The create and delete events do not support filtering like push and pull_request do.

1 Like