Skip to content

Commit 4acb06d

Browse files
authored
Restrict workflow triggers to relevant PHP files (#2181)
1 parent 2df5087 commit 4acb06d

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

.github/workflows/phpcs.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,21 @@ on:
33
push:
44
branches:
55
- trunk
6+
paths:
7+
- '**/*.php'
8+
- 'composer.json'
9+
- 'composer.lock'
10+
- 'phpunit.xml.dist'
11+
- 'phpcs.xml'
12+
- '.github/workflows/phpcs.yml'
613
pull_request:
14+
paths:
15+
- '**/*.php'
16+
- 'composer.json'
17+
- 'composer.lock'
18+
- 'phpunit.xml.dist'
19+
- 'phpcs.xml'
20+
- '.github/workflows/phpcs.yml'
721
jobs:
822
phpcs:
923
runs-on: ubuntu-latest

.github/workflows/phpunit.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,21 @@ on:
33
push:
44
branches:
55
- trunk
6+
paths:
7+
- '**/*.php'
8+
- 'composer.json'
9+
- 'composer.lock'
10+
- 'phpunit.xml.dist'
11+
- 'phpcs.xml'
12+
- '.github/workflows/phpunit.yml'
613
pull_request:
14+
paths:
15+
- '**/*.php'
16+
- 'composer.json'
17+
- 'composer.lock'
18+
- 'phpunit.xml.dist'
19+
- 'phpcs.xml'
20+
- '.github/workflows/phpunit.yml'
721
jobs:
822
phpunit:
923
runs-on: ubuntu-latest
@@ -103,15 +117,15 @@ jobs:
103117
# Check for PHPUnit warnings and process them
104118
if grep -q "WARNINGS!\|There was.*warning" coverage-output.log; then
105119
echo "Processing coverage warnings for checkstyle report..."
106-
120+
107121
# Show warnings section for debugging
108122
echo "--- Warnings Found ---"
109123
sed -n '/There was.*warning/,/WARNINGS!/p' coverage-output.log | head -10
110124
echo "--- End Warnings ---"
111-
125+
112126
# Extract warnings to temporary file to avoid subshell issues
113127
sed -n '/There was.*warning/,/WARNINGS!/p' coverage-output.log > temp-warnings.txt
114-
128+
115129
# Process each line
116130
while IFS= read -r line; do
117131
echo "Processing line: $line"
@@ -122,7 +136,7 @@ jobs:
122136
if [[ "$line" =~ \"@covers\ ([^\"]+)\" ]]; then
123137
COVERS_TARGET="${BASH_REMATCH[1]}"
124138
echo "Processing @covers warning for: $COVERS_TARGET"
125-
139+
126140
# Find test file and line number
127141
echo "Searching for @covers annotation with target: $COVERS_TARGET"
128142
# Extract just the method name from the full class::method
@@ -147,7 +161,7 @@ jobs:
147161
echo "::warning::PHPUnit deprecation warning: ${line}"
148162
fi
149163
done < temp-warnings.txt
150-
164+
151165
rm -f temp-warnings.txt
152166
WARNINGS_FOUND=true
153167
else

0 commit comments

Comments
 (0)