Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github Actions - How do you trigger a push when a specific directory in a branch gets an update?

I want my workflow to trigger on a push only if there are changes made to a specific directory. Is this possible, what am I missing? I tried doing something like what you see below, but it didn't fire the trigger.

name: ABC

on:
  push:
    branches:  [master/my-directory]
  pull_request:
    branches: [ master ]
like image 632
Joe Avatar asked Aug 18 '20 02:08

Joe


1 Answers

push has a property called paths:

name: ABC
on:
  push:
    branches:
      - master
    paths:
      - my-directory/**

This will only trigger on pushes to the master branch with changes in the my-directory directory tree. See the filter pattern cheat sheet for all possible filter patterns.

like image 104
Benjamin W. Avatar answered Oct 01 '22 20:10

Benjamin W.