How To Trigger Harness Pipeline Based On Changes To Sub Folders On GitHub Repository?


Harness CI , Harness CD


Infrastructure: Kubernetes

OS: Linux


I am trying to trigger the pipeline only when there’s a change in a specific subfolder of the Git repository. I have the below repository structure and I only want to trigger the pipeline when changes are made in the Subfolder* path.

  |- Subfolder1
    |- file1.yaml
    |- file2.yaml
  |- Subfolder2
    |- file1.yaml
    |- file2.yaml


A path-based trigger can be achieved by using regex conditions in your trigger definition. To set a regex condition go to Pipeline > pipeline_name > triggers > trigger_name > Conditions. Now select the regex operator in Changed files and pass a regex expression. Use the following regex expression to identify changes in a specific subfolder subFolder($|\/.*)

Hi ronak, did that work for you?, I tested it in one of my pipelines but it does not get trigger.

Hi Nikol ,

yes, it did. can you let me know your use case in order to help you better?