Skip to content

Commit

Permalink
fix pr meta script
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Coder committed Mar 27, 2024
1 parent cdb31fa commit 785eacd
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 785eacd

Please sign in to comment.