Skip to content

#17: Basic create game page #48

#17: Basic create game page

#17: Basic create game page #48

Workflow file for this run

name: SonarCloud analysis
on:
push:
branches: [ "main" ]
pull_request:
types: [ opened, synchronize, reopened ]
workflow_dispatch:
permissions:
pull-requests: read # allows SonarCloud to decorate PRs with analysis results
jobs:
sonarcloud:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Disabling shallow clones is recommended for improving the relevancy of reporting
fetch-depth: 0
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }} # Generate a token on Sonarcloud.io, and add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)
with:
args:
-Dsonar.projectKey=valentk777_SeaBattlePaper
-Dsonar.organization=valentk777
-Dsonar.exclusions=**/*.java,**/*.cpp,**/*.c,**/*.h,**/*.m,**/*.mm
- name: Check SonarCloud Quality Gate status
run: |
sleep 30s # Wait for results to be uploaded
GATE_STATUS=$(curl https://sonarcloud.io/api/qualitygates/project_status?projectKey=valentk777_SeaBattlePaper --silent | jq .projectStatus.status)
echo "Gate status: $GATE_STATUS"
# Will fail if equal to ERROR, pass if equal to OK
if [[ $GATE_STATUS != "ERROR" ]]; then
echo "Quality gate passed"
else
echo "Quality gate failed"
exit 1 # Fail the pipeline
fi