From 785eacd232e79d995ca4f2b8c006bdc2e0be989f Mon Sep 17 00:00:00 2001 From: Simon D Fink Date: Wed, 27 Mar 2024 22:26:42 +0100 Subject: [PATCH] fix pr meta script --- .github/workflows/sonar.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 4cb013864..3395b057b 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -13,6 +13,7 @@ jobs: steps: - name: Install sonar-scanner uses: SonarSource/sonarcloud-github-c-cpp@v2 + cache-binaries: false - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} @@ -46,16 +47,16 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - var fs = require('fs'); - var pr_number = Number(fs.readFileSync('static-analysis/PR-NUMBER')); - var pr_meta = await github.pulls.get({ - ${{ github.event.workflow_run.repository.owner.login }}, - ${{ github.event.workflow_run.repository.name }}, - pr_number, + const fs = require('fs'); + const pr_number = Number(fs.readFileSync('static-analysis/PR-NUMBER')); + const { data: pr_meta } = await github.pulls.get({ + owner: '${{ github.event.workflow_run.repository.owner.login }}', + repo: '${{ github.event.workflow_run.repository.name }}', + pull_number: pr_number, }); console.log(pr_meta); - if (github.event.workflow_run.head_commit.id != pr_meta.head.sha) { - core.setFailed('Triggering workflow commit sha doesn't match claimed PR head commit sha!'); + if ('${{ github.event.workflow_run.head_commit.id }}' != pr_meta.head.sha) { + core.setFailed('Triggering workflow commit sha does not match claimed PR head commit sha!'); } return pr_meta; - name: Dump GitHub context 2