Skip to content

Commit 6ceda18

Browse files
chore: lint php files
1 parent 846d3ce commit 6ceda18

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ jobs:
3535
compose.yaml
3636
compose.override.yaml
3737
set: |
38-
*.cache-from=type=gha,scope=${{github.ref}}
38+
*.cache-from=type=gha,scope=${{ github.ref }}
3939
*.cache-from=type=gha,scope=refs/heads/main
40-
*.cache-to=type=gha,scope=${{github.ref}},mode=max
40+
*.cache-to=type=gha,scope=${{ github.ref }},mode=max
4141
-
4242
name: Start services
4343
run: docker compose up --wait --no-build
@@ -113,10 +113,10 @@ jobs:
113113
compose.yaml
114114
compose.prod.yaml
115115
set: |
116-
*.cache-from=type=gha,scope=${{github.ref}}-e2e
117-
*.cache-from=type=gha,scope=${{github.ref}}
116+
*.cache-from=type=gha,scope=${{ github.ref }}-e2e
117+
*.cache-from=type=gha,scope=${{ github.ref }}
118118
*.cache-from=type=gha,scope=refs/heads/main
119-
*.cache-to=type=gha,scope=${{github.ref}}-e2e,mode=max
119+
*.cache-to=type=gha,scope=${{ github.ref }}-e2e,mode=max
120120
-
121121
name: Start Services
122122
run: docker compose up --wait --no-build
@@ -176,14 +176,44 @@ jobs:
176176
path: pwa/test-results
177177

178178
lint:
179-
name: Docker Lint
179+
name: Lint
180180
runs-on: ubuntu-latest
181181
steps:
182182
-
183183
name: Checkout
184184
uses: actions/checkout@v4
185+
186+
# Lint Dockerfiles
185187
-
186188
name: Lint Dockerfiles
187189
uses: hadolint/[email protected]
188190
with:
189191
recursive: true
192+
193+
# Lint API PHP files
194+
-
195+
name: PHP CS Fixer Cache
196+
uses: actions/cache@v3
197+
with:
198+
path: api/.php-cs-fixer.cache
199+
key: ${{ runner.OS }}-phpcsfixer-${{ github.sha }}
200+
restore-keys: |
201+
${{ runner.OS }}-phpcsfixer-
202+
-
203+
name: Get API changed files
204+
id: api-changed-files
205+
uses: tj-actions/changed-files@v38
206+
-
207+
name: Get Extra Arguments for PHP-CS-Fixer
208+
id: phpcs-intersection
209+
run: |
210+
CHANGED_FILES=$(echo "${{ steps.changed-files.outputs.all_changed_and_modified_files }}" | tr ' ' '\n')
211+
if ! echo "${CHANGED_FILES}" | grep -qE "^api\/(\\.php-cs-fixer(\\.dist)?\\.php|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi
212+
echo "PHPCS_EXTRA_ARGS<<EOF" >> $GITHUB_ENV
213+
echo "$EXTRA_ARGS" >> $GITHUB_ENV
214+
echo "EOF" >> $GITHUB_ENV
215+
-
216+
name: Lint API PHP Files
217+
uses: docker://oskarstark/php-cs-fixer-ga
218+
with:
219+
args: --config=api/.php-cs-fixer.dist.php -v --dry-run --stop-on-violation --using-cache=no ${{ env.PHPCS_EXTRA_ARGS }}"

0 commit comments

Comments
 (0)