v2.1.12 #215
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# * b. Generate a new token and add it to your Github repository's secrets using the name SONAR_TOKEN | |
# (On SonarCloud, click on your avatar on top-right > My account > Security | |
# or go directly to https://sonarcloud.io/account/security/) | |
# Feel free to take a look at our documentation (https://docs.sonarcloud.io/getting-started/github/) | |
# or reach out to our community forum if you need some help (https://community.sonarsource.com/c/help/sc/9) | |
name: SonarCloud analysis | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
pull-requests: read # allows SonarCloud to decorate PRs with analysis results | |
jobs: | |
Analysis: | |
if: github.repository == 'hunkim98/dotting' | |
runs-on: ubuntu-latest | |
steps: | |
# this moves to the directory of dotting! | |
- uses: actions/checkout@v2 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
# - name: "Download code coverage" | |
# uses: actions/github-script@v6 | |
# 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 == "coverage-report" | |
# })[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}/coverage-report.zip`, Buffer.from(download.data)); | |
# - name: "Unzip code coverage" | |
# run: unzip coverage-report.zip -d coverage | |
- name: Install dependencies | |
run: yarn | |
- name: Test and coverage | |
run: yarn jest --coverage | |
- name: Analyze with SonarCloud | |
# You can pin the exact commit or the version. | |
# uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049 | |
# uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049 | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret) |