-
Notifications
You must be signed in to change notification settings - Fork 588
68 lines (59 loc) · 2.07 KB
/
Copy pathsonarcloud.yml
File metadata and controls
68 lines (59 loc) · 2.07 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: SonarCloud
on:
workflow_call:
secrets:
SONAR_TOKEN:
required: false
permissions:
contents: read
jobs:
sonar:
name: SonarCloud analysis (non-blocking)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Detect whether the token is available
id: sonar-token
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
if [[ -n "${SONAR_TOKEN}" ]]; then
echo "available=true" >> "${GITHUB_OUTPUT}"
else
echo "available=false" >> "${GITHUB_OUTPUT}"
fi
- name: Skip analysis when the token is unavailable
if: steps.sonar-token.outputs.available != 'true'
run: echo "SONAR_TOKEN is unavailable; non-blocking analysis skipped."
- name: Check out repository
if: steps.sonar-token.outputs.available == 'true'
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Download this run's combined coverage
if: steps.sonar-token.outputs.available == 'true'
uses: actions/download-artifact@v7
with:
name: python-coverage-xml
- name: Download this run's TypeScript coverage
if: steps.sonar-token.outputs.available == 'true'
uses: actions/download-artifact@v7
with:
name: typescript-control-plane-coverage
path: coverage/control-plane
- name: Download this run's dashboard coverage
if: steps.sonar-token.outputs.available == 'true'
uses: actions/download-artifact@v7
with:
name: dashboard-coverage
path: coverage/dashboard
- name: SonarCloud scan
if: steps.sonar-token.outputs.available == 'true'
# Analysis-only: findings are reported to the PR/dashboard but never
# block merge. Remove this flag only if the quality gate becomes a
# required check.
continue-on-error: true
uses: SonarSource/sonarqube-scan-action@v8.2.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}