mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 05:31:24 +00:00
Skip PHP CI jobs when only non-PHP files change
Replace workflow-level paths-ignore with per-job filtering using dorny/paths-filter. PHP lint and test jobs now only run when PHP-related files (app/, config/, database/, routes/, tests/, composer.*, phpunit.xml) are modified.
This commit is contained in:
39
.github/workflows/check.yaml
vendored
39
.github/workflows/check.yaml
vendored
@@ -3,28 +3,41 @@ name: Check
|
||||
# Run this workflow every time a new commit pushed to your repository
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- '.github/**/*'
|
||||
- '**/*.md'
|
||||
- 'public/build/*.js'
|
||||
- 'public/build/**/*.js'
|
||||
- 'docker/**/*'
|
||||
- 'resources/scripts/**/*'
|
||||
tags-ignore:
|
||||
- "*"
|
||||
branches-ignore:
|
||||
- 'translations'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- 'public/build/*.js'
|
||||
- 'public/build/**/*.js'
|
||||
branches-ignore:
|
||||
- 'translations'
|
||||
# Allow manually triggering the workflow.
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: 🔍 Detect changes
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
php: ${{ steps.filter.outputs.php }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check for file changes
|
||||
uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
php:
|
||||
- 'app/**'
|
||||
- 'config/**'
|
||||
- 'database/**'
|
||||
- 'routes/**'
|
||||
- 'tests/**'
|
||||
- 'composer.json'
|
||||
- 'composer.lock'
|
||||
- 'phpunit.xml'
|
||||
|
||||
kill_previous:
|
||||
name: 0️⃣ Kill previous runs
|
||||
runs-on: ubuntu-latest
|
||||
@@ -41,6 +54,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- kill_previous
|
||||
- changes
|
||||
if: needs.changes.outputs.php == 'true'
|
||||
steps:
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
@@ -60,6 +75,8 @@ jobs:
|
||||
name: 2️⃣ PHP ${{ matrix.php-version }} Tests
|
||||
needs:
|
||||
- php_syntax_errors
|
||||
- changes
|
||||
if: needs.changes.outputs.php == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
|
||||
Reference in New Issue
Block a user