|
@@ -5,8 +5,30 @@ on:
|
|
types: [opened, reopened, synchronize]
|
|
types: [opened, reopened, synchronize]
|
|
|
|
|
|
jobs:
|
|
jobs:
|
|
|
|
+ check_php_files:
|
|
|
|
+ runs-on: ubuntu-latest
|
|
|
|
+ outputs:
|
|
|
|
+ php_changed: ${{ steps.check_file_changed.outputs.php_file_changed }}
|
|
|
|
+ steps:
|
|
|
|
+ - uses: actions/checkout@v2
|
|
|
|
+ with:
|
|
|
|
+ fetch-depth: 2
|
|
|
|
+ - shell: pwsh
|
|
|
|
+ id: check_php_file_changed
|
|
|
|
+ run: |
|
|
|
|
+ # Diff HEAD with the previous commit
|
|
|
|
+ $diff = git diff --name-only HEAD^ HEAD
|
|
|
|
+
|
|
|
|
+ # Check if a file under docs/ or with the .md extension has changed (added, modified, deleted)
|
|
|
|
+ $SourceDiff = $diff | Where-Object { $_ -match '.php$' }
|
|
|
|
+ $HasDiff = $SourceDiff.Length -gt 0
|
|
|
|
+
|
|
|
|
+ # Set the output named "docs_changed"
|
|
|
|
+ Write-Host "::set-output name=php_file_changed::$HasDiff"
|
|
lint:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
runs-on: ubuntu-latest
|
|
|
|
+ needs: [ check_php_files ]
|
|
|
|
+ if: needs.check_php_files.outputs.php_file_changed == 'True'
|
|
steps:
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
with:
|