github.com/instana/go-sensor@v1.62.2-0.20240520081010-4919868049e1/.github/workflows/sonarqube.yml (about) 1 name: Generate SonarQube report 2 on: 3 workflow_run: 4 workflows: [Generate code coverage and upload to artifact] 5 types: [completed] 6 jobs: 7 build: 8 name: Run analysis 9 runs-on: ubuntu-latest 10 if: github.event.workflow_run.conclusion == 'success' 11 steps: 12 - uses: actions/checkout@v3 13 with: 14 fetch-depth: 0 15 - name: 'Download code coverage' 16 uses: actions/github-script@v6 17 with: 18 script: | 19 let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ 20 owner: context.repo.owner, 21 repo: context.repo.repo, 22 run_id: context.payload.workflow_run.id, 23 }); 24 let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { 25 return artifact.name == "go-tracer-code-coverage" 26 })[0]; 27 let download = await github.rest.actions.downloadArtifact({ 28 owner: context.repo.owner, 29 repo: context.repo.repo, 30 artifact_id: matchArtifact.id, 31 archive_format: 'zip', 32 }); 33 let fs = require('fs'); 34 fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/go-tracer-code-coverage.zip`, Buffer.from(download.data)); 35 - name: 'Unzip code coverage' 36 run: unzip go-tracer-code-coverage.zip -d coverage 37 - name: Sonarqube Scan 38 uses: sonarsource/sonarqube-scan-action@master 39 40 env: 41 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 42 SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}