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.
GitHub Actions uses YAML syntax to define the workflow. Each workflow is stored as a separate YAML file in your code repository, in a directory named . github/workflows .
To run jobs sequentially, you can define dependencies on other jobs using the jobs. <job_id>. needs keyword. Each job runs in a runner environment specified by runs-on .
Earlier this week, GitHub announced a new feature which allows developers to trigger workflows manually from within the “Actions” tab.
The default all commands are executed at root directory of the application. In some cases, you need to execute any command for the sub directories. It's possible by setting the working-directory directive in the configuration file.
The normal syntax involves a path filter
on:
push:
paths:
- folder1/**
If that is not enough, you also have the GitHub Action Path Filter.
Path filters only work at workflow level.
on:
push:
paths:
- 'sub-project/**'
If you want to apply this at job level, look for changed-files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With