Skip to content

Commit d76cd30

Browse files
Update workflow
1 parent 300bcc2 commit d76cd30

1 file changed

Lines changed: 27 additions & 4 deletions

File tree

‎.github/workflows/ibm-sonar.yml‎

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ jobs:
2222
# Fork PRs don't receive secrets, so the scan can't authenticate. Skip cleanly.
2323
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
2424

25+
# Per-repo Sonar configuration. You must update SONAR_PROJECT_KEY and
26+
# SONAR_PROJECT_NAME when copying this workflow to another repository, along
27+
# with the branch filters above (i.e. if the repository uses `master`
28+
# instead of `main`). Project key format is <org-id>-<project-id>. Only
29+
# update SONAR_SOURCES if only a portion of the repository should be
30+
# scanned.
31+
env:
32+
SONAR_PROJECT_KEY: 544478-685614324
33+
SONAR_PROJECT_NAME: riptano/docs-ui
34+
SONAR_SOURCES: "."
35+
2536
steps:
2637
- name: Checkout Repository
2738
uses: actions/checkout@v6
@@ -45,14 +56,26 @@ jobs:
4556
SONAR_TOKEN: ${{ secrets.IBM_SONARQUBE_API_TOKEN }}
4657
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
4758
with:
48-
# The `projectKey` and `projectName` values are repo-specific - update them if copying this workflow.
4959
args: >
50-
-D sonar.projectKey=544478-685614324
51-
-D sonar.projectName=riptano/docs-ui
52-
-D sonar.sources=.
60+
-D sonar.projectKey=${{ env.SONAR_PROJECT_KEY }}
61+
-D sonar.projectName=${{ env.SONAR_PROJECT_NAME }}
62+
-D sonar.sources=${{ env.SONAR_SOURCES }}
5363
-D sonar.scanner.truststorePath=${{ runner.temp }}/ibm_castorevpcprod
5464
-D sonar.scanner.truststorePassword=${{ secrets.IBM_SONARQUBE_CERT_PASSWORD }}
5565
5666
- name: Clean Up Trust Store Certificate
5767
if: always()
5868
run: rm -f "$RUNNER_TEMP/ibm_castorevpcprod"
69+
70+
- name: Link to Results
71+
if: always()
72+
env:
73+
DASHBOARD_URL: https://sonarqube-prod.apps.wdc-sonarqube-prod.core.cirrus.ibm.com
74+
PR_NUMBER: ${{ github.event.pull_request.number }}
75+
run: |
76+
set -euo pipefail
77+
url="${DASHBOARD_URL}/dashboard?id=${SONAR_PROJECT_KEY}"
78+
if [ -n "$PR_NUMBER" ]; then
79+
url="${url}&pullRequest=${PR_NUMBER}"
80+
fi
81+
echo "[See analysis details on SonarQube]($url)" >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)