forked from angular-schule/ngx-deploy-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 15
51 lines (46 loc) · 1.88 KB
/
sonar-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Sonar for PRs
on:
workflow_run:
workflows: ['PRs']
types: [completed]
jobs:
sonar:
name: Sonar
runs-on: ubuntu-latest
timeout-minutes: 30
if: github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.workflow_run.head_repository.full_name }}
ref: ${{ github.event.workflow_run.head_branch }}
fetch-depth: 0
- name: Debug Workflow Info
run: |
echo "Workflow Run ID: ${{ github.event.workflow_run.id }}"
echo "Workflow Head SHA: ${{ github.event.workflow_run.head_sha }}"
echo "Current SHA: ${{ github.sha }}"
echo "Head Branch: ${{ github.event.workflow_run.head_branch }}"
echo "Repository: ${{ github.event.workflow_run.head_repository.full_name }}"
# Output raw context for additional details
echo "=== Raw Context ==="
echo "Workflow Head SHA: ${{ github.event.workflow_run }}"
- name: 'Raw Context'
uses: actions/github-script@v6
with:
script: |
JSON.stringify(${{ github.event.workflow_run }}, null, 2)
# Download reports
- uses: ./.github/actions/download-coverage-report
- uses: ./.github/actions/download-lint-report
- name: SonarCloud Scan
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_SCANNER }}
with:
args: >
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }}
-Dsonar.pullrequest.key=${{ github.event.workflow_run.pull_requests[0].number }}
-Dsonar.pullrequest.branch=${{ github.event.workflow_run.pull_requests[0].head.ref }}
-Dsonar.pullrequest.base=${{ github.event.workflow_run.pull_requests[0].base.ref }}