diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 240c0aa5b..18ea2014e 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -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: @@ -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