An easy-to-use GitHub Action that detects file changes in the last commit under a specified folder and executes a command if changes are found.
- Detects changes in the last commit for a specific folder.
- Executes any command if changes are detected.
- Customizable folder path and command via action inputs.
- Ideal for CI/CD pipelines, automation scripts, and more.
To use this GitHub Action, create a workflow YAML file (e.g., .github/workflows/main.yml
) in your repository and include the following content:
name: Execute on Changes
on: [push]
jobs:
check_changes:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Execute on changes
uses: FranklyRocks/exec-on-changes@v1
with:
path: 'your/folder/path'
command: 'your-command'
path
: Path where to find changes in files (required).command
: Command to execute if changes in files are found (required).
-
Restart the queue worker if any queue-related files are changed:
- name: Execute on changes uses: FranklyRocks/exec-on-changes@v1 with: path: 'app/Jobs' command: 'php artisan queue:restart'
-
Run PHPStan for static analysis if any PHP files in the
app
directory are changed:- name: Execute on changes uses: FranklyRocks/exec-on-changes@v1 with: path: 'app' command: 'vendor/bin/phpstan analyse'
-
Run Laravel Dusk tests if any files in the
tests/Browser
directory are changed:- name: Execute on changes uses: FranklyRocks/exec-on-changes@v1 with: path: 'tests/Browser' command: 'php artisan dusk'
-
Run style checks if any CSS or SCSS files in the
resources/css
directory are changed:- name: Execute on changes uses: FranklyRocks/exec-on-changes@v1 with: path: 'resources/css' command: 'npm run stylelint'
-
Run migrations if any migration files are changed:
- name: Execute on changes uses: FranklyRocks/exec-on-changes@v1 with: path: 'database/migrations' command: 'php artisan migrate'
This project is licensed under the MIT License. See the LICENSE file for details.
If you encounter any issues or have any questions, feel free to open an issue on GitHub.