Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub Actions Ignore Certain Files Inside a Directory

I have a project where I use GitHub Actions. I now need to ignore certain file changes inside certain folders. Here is my project structure:

masterDir
 - contentDir
   - dir1
     - file1.ignore.md
     - file2.md
  -  dir2
     - file3.md
     - file4.ignore.md

So I would like that my GitHub actions are not triggered for any changes to any file that has ignore.md in its file name. So here is what I came up with, but that does not seem to work.

on:
  push:
    paths-ignore:
      - 'README.md'
      - 'backup/**'
      - 'masterDir/contentDir/**/*.draft.md'

Any ideas on what is wrong with my wildcard match?

like image 737
joesan Avatar asked Nov 27 '25 17:11

joesan


1 Answers

It was indeed quite simple to do. All I have to do is the following:

on:
  push:
    paths-ignore:
      - 'README.md'
      - 'backup/**'
      - '**/*.draft.md'

As a reference, here is the documentation in detail: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#patterns-to-match-file-paths

As it can be seen from the documentation that the wildcard matches any file in any folder that contains a .draft.md match.

like image 134
joesan Avatar answered Nov 30 '25 06:11

joesan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!