forked from uyuni-project/uyuni
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (59 loc) · 2.39 KB
/
Copy pathsonarcloud.yml
File metadata and controls
70 lines (59 loc) · 2.39 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
69
70
name: Sonarcloud scan
on:
workflow_run:
workflows: [Java checkstyle]
types: [completed]
permissions:
contents: read
actions: read
jobs:
sonarcloud-scan:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0
- name: Download Java built artifact
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd #v8.0.0
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "java-built-files"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/java-built-files.zip`, Buffer.from(download.data));
- name: Unzip java built artifact
run: |
unzip java-built-files.zip
- name: Unpacking the build results
run: tar xf java-build.tar.gz
- name: Read the PR data file
run: cat pr_data >>"$GITHUB_ENV"
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602 # v6.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_AUTH_UYUNI }}
PR_BRANCH: ${{ github.event.workflow_run.head_branch }}
with:
args: >
-Dsonar.junit.reportPaths=""
-Dsonar.coverage.jacoco.xmlReportPaths=""
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }}
-Dsonar.pullrequest.key=${{ env.PR_NUMBER }}
-Dsonar.pullrequest.branch=${{ env.PR_BRANCH }}
-Dsonar.pullrequest.base=${{ env.PR_BASE }}