Merge pull request #57 from adan-ea/dependabot/npm_and_yarn/babel/tra… #101
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
name: SonarCloud analysis | |
on: | |
push: | |
branches: ['main', 'develop'] | |
pull_request: | |
branches: ['main'] | |
workflow_dispatch: | |
permissions: | |
pull-requests: read | |
jobs: | |
sonarcloud: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: npm ci | |
- name: Test and coverage | |
run: npm test --coverage | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
with: | |
args: -Dsonar.projectKey=adan-ea_adroid_ea | |
-Dsonar.organization=adanea-adroid-ea | |
- name: SonarCloud Quality Gate status | |
id: sonar_status | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
quality_gate_status=$(curl -s -u "${{ secrets.SONAR_TOKEN }}:" -X GET \ | |
"https://sonarcloud.io/api/qualitygates/project_status?projectKey=adan-ea_adroid_ea") | |
echo "$quality_gate_status" | |
status=$(echo "$quality_gate_status" | cut -c 29-30) | |
echo "result=$status" >> "$GITHUB_OUTPUT" | |
echo "$status" | |
- name: Write to workflow job summary | |
run: | | |
SUMMARY=$'# Testing Job Summary\n## Résultat Sonar\n${{ steps.sonar_status.outputs.result == 'OK' }}' | |
echo "$SUMMARY" >> $GITHUB_STEP_SUMMARY |