Github action GLOB event filtering DOES NOT work as expected

I have a workflow to bump our repo tag and it will be triggered once changes are coming from any files under production folder. See my snippets below.

# bump-my-tag-version.yaml
name: Bump my tag version!

on:
  push:
    branches:
      - 'master'
    paths:
      - '**/production'
      - '!excluded_dir/production'

jobs:
  bump-version:
    runs-on: ubuntu-20.04
...

I have a few directories that has production folder as seen below.

excluded_dir/production
included_A/some_dir/production
included_B/some1/some2/production
included_C/some1/some2/some3/production

When I merge my changes to my main branch (master), it did not trigger the workflow. Which I expect it should because this filtering has already been implemented. See this post from GitHub.

Is this a bug or something is wrong with my implementation?

I believe you need asterisk or double asterisk on your globs right side, because it isn’t about the path itself but rather things below that path. Ex: the files you’re changing.

1 Like

I’ll try this @kingthorin. Thanks for the suggestion. I may have missed that part. I’ll let you know soon.

Hey @kingthorin, your suggestion works! Thank you so much!

Just to summarised the solution:

# bump-my-tag-version.yaml
name: Bump my tag version!

on:
  push:
    branches:
      - 'master'
    paths:
      - '**/production/**' # <-- added 2 asterisks here
       - '!excluded_dir/production/**' # <-- added 2 asterisks here

jobs:
  bump-version:
    runs-on: ubuntu-20.04

Great glad we got that sorted out.