Sunday, October 9, 2022

[FIXED] How to run GitHub Actions workflow only if the pushed files are in a specific folder

Issue

I have a folder structure that looks something like this.

- folder1
  - file1
  - *other files*
- folder2
  - file1
  - *other files*
- .gitignore
- package.json
- *other files*

I want to run my GitHub Actions workflow on push, only if any of the changed/pushed files are located in the folder1 directory/folder.


Solution

The normal syntax involves a path filter

on:
  push:
    paths:
      - folder1/**

If that is not enough, you also have the GitHub Action Path Filter.



Answered By - VonC
Answer Checked By - Marilyn (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.