Skip to content

feat: detailed status during web app bootstrap; handle token errors (… #156

feat: detailed status during web app bootstrap; handle token errors (…

feat: detailed status during web app bootstrap; handle token errors (… #156

name: Client SonarCloud
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- "client/src/js/**"
- "client/src/css/**"
- "client/src/serviceWorker.js"
- ".github/workflows/client-sonarcloud.yml"
push:
branches:
- main
paths:
- "client/src/js/**"
- "client/src/css/**"
- "client/src/serviceWorker.js"
- ".github/workflows/client-sonarcloud.yml"
permissions:
pull-requests: read # allows SonarCloud to decorate PRs with analysis results
jobs:
SonarCloudAnalysis-Client:
name: SonarCloud Analysis client
runs-on: ubuntu-latest
steps:
- name: Check if PR is from a fork
id: check_fork
run: |
if [ "${{ github.event.pull_request.head.repo.fork }}" == "true" ]; then
echo "This is a PR from a fork, skipping sonarcloud analysis."
echo "SKIP_STEP=true" >> $GITHUB_ENV
fi
#checkout the repo
- name: Checkout repository
if: env.SKIP_STEP != 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0 # Important to fetch all history for accurate blame information
- name: Analyze client with SonarCloud
if: env.SKIP_STEP != 'true'
uses: SonarSource/sonarcloud-github-action@v2.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_CLIENT }} # Needed to push to SonarCloud
with:
projectBaseDir: ./client/src
# Additional arguments for the sonarcloud scanner
args: -Dsonar.projectKey=nuwcdivnpt_stig-manager-client
-Dsonar.projectName=nuwcdivnpt_stig-manager-client
-Dsonar.organization=nuwcdivnpt
-Dsonar.inclusions=**/*.js,**/*.html,**/*.css
-Dsonar.exclusions=**/node_modules/**
# This will fail the action if Quality Gate fails (leaving out for now )
# - name: Check Quality Gate
# uses: sonarsource/sonarqube-quality-gate-action@master
# env:
# SONAR_TOKEN: