Skip to content

Commit

Permalink
Upload code scanning results to correct ref when releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Jun 17, 2024
1 parent 42f5a49 commit 0468f55
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ jobs:
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref }}

- name: "Get SHA hash of checked out ref"
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo CHECKED_OUT_SHA=$(git rev-parse HEAD) >> $GITHUB_ENV
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand Down Expand Up @@ -58,12 +63,21 @@ jobs:
- name: Run PHPStan
run: ./vendor/bin/phpstan analyse --no-interaction --no-progress --ansi --error-format=sarif > phpstan.sarif
continue-on-error: true

- name: "Upload SARIF report"
if: always()
if: ${{ github.event_name != 'workflow_dispatch' }}
uses: "github/codeql-action/upload-sarif@v3"
with:
sarif_file: phpstan.sarif

- name: "Upload SARIF report"
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: "github/codeql-action/upload-sarif@v3"
with:
sarif_file: phpstan.sarif
ref: ${{ inputs.ref }}
sha: ${{ env.CHECKED_OUT_SHA }}

- name: Save cache PHPStan results
id: phpstan-cache-save
Expand Down

0 comments on commit 0468f55

Please sign in to comment.