Skip to content

Commit 274a172

Browse files
authored
Merge pull request #914 from hydephp/refactor-psalm-action
Internal: Update GitHub action to exit more or less gracefully with skipped status instead of fail
2 parents f528e30 + 0056d2c commit 274a172

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.github/workflows/static-analysis.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ on:
77
jobs:
88

99
psalm:
10-
name: Psalm Static Analysis
10+
name: Run Analysis
1111
runs-on: ubuntu-latest
12+
continue-on-error: true
13+
outputs:
14+
exit-code: ${{ steps.analysis.outputs.EXIT_CODE }}
1215
steps:
1316
- name: Checkout code
1417
uses: actions/checkout@v2
@@ -17,4 +20,20 @@ jobs:
1720
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
1821

1922
- name: Run Psalm
20-
run: vendor/bin/psalm
23+
id: analysis
24+
run: |
25+
vendor/bin/psalm
26+
echo EXIT_CODE=$? >> $GITHUB_OUTPUT
27+
exit 0;
28+
29+
30+
# Since GitHub Actions for some reason doesn't support exiting with warnings, we work around this by
31+
# adding a second job. If the first job fails, this one won't run, thus resulting with a skipped status.
32+
report-psalm:
33+
name: Psalm Static Analysis
34+
runs-on: ubuntu-latest
35+
needs: psalm
36+
if: needs.psalm.outputs.exit-code == 0
37+
steps:
38+
- name: Report analysis passed
39+
run: exit 0;

0 commit comments

Comments
 (0)