5555 servers : ' [{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
5656
5757 - name : Request GitHub API for PR data
58- if : github.event.workflow_run.event == 'pull_request'
58+ if : github.event_name == 'pull_request'
5959 uses : octokit/request-action@b91aabaa861c777dcdb14e2387e30eddf04619ae # v3.0.0
6060 id : get_pr_data
6161 with :
@@ -71,12 +71,12 @@ jobs:
7171 echo "sonar_opts=-Dsonar.host.url=https://sonarcloud.io -Dsonar.projectKey=com-pas_compas-scl-data-service -Dsonar.organization=com-pas" >> "$GITHUB_OUTPUT"
7272
7373 - name : Build and analyze (Pull Request)
74- if : ${{ github.event.workflow_run.event == 'pull_request' }}
74+ if : ${{ github.event_name == 'pull_request' }}
7575 env :
7676 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7777 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
7878 SONAR_OPTS : ${{ steps.sonar_env.outputs.sonar_opts }}
79- HEAD_SHA : ${{ github.event.workflow_run.head_sha }}
79+ HEAD_SHA : ${{ github.event.pull_request.head.sha }}
8080 run : |
8181 mvn -B -s custom_maven_settings.xml -Psonar \
8282 $SONAR_OPTS \
@@ -87,16 +87,14 @@ jobs:
8787 verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
8888
8989 - name : Build and analyze (Push)
90- if : ${{ github.event.workflow_run.event == 'push' }}
90+ if : ${{ github.event_name == 'push' }}
9191 env :
9292 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
9393 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
9494 SONAR_OPTS : ${{ steps.sonar_env.outputs.sonar_opts }}
95- HEAD_SHA : ${{ github.event.workflow_run.head_sha }}
96- HEAD_BRANCH : ${{ github.event.workflow_run.head_branch }}
95+ HEAD_BRANCH : ${{ github.ref_name }}
9796 run : |
9897 mvn -B -s custom_maven_settings.xml -Psonar \
9998 $SONAR_OPTS \
100- -Dsonar.scm.revision="$HEAD_SHA" \
10199 -Dsonar.branch.name="$HEAD_BRANCH" \
102100 verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
0 commit comments