- Disable WordPress Playground tests from automatic PR/push triggers (WordPress Playground CLI doesn't start reliably in GitHub Actions) - Disable SonarCloud workflow (SONAR_TOKEN returns HTTP 403) - Comment out SonarCloud job in code-quality.yml - Keep workflows available for manual debugging via workflow_dispatch - PHPUnit tests and code quality checks remain active
72 lines
2.4 KiB
YAML
72 lines
2.4 KiB
YAML
name: SonarCloud Analysis
|
|
|
|
# NOTE: This workflow requires a valid SONAR_TOKEN secret to be configured.
|
|
# If you see HTTP 403 errors, the token may be expired or invalid.
|
|
# Generate a new token at: https://sonarcloud.io/account/security
|
|
|
|
on:
|
|
# Only run manually until SONAR_TOKEN is properly configured
|
|
workflow_dispatch:
|
|
inputs:
|
|
force_run:
|
|
description: 'Force run even if token validation fails'
|
|
required: false
|
|
default: 'false'
|
|
|
|
# Commented out automatic triggers until SONAR_TOKEN is properly configured:
|
|
# push:
|
|
# branches: [ main, feature/* ]
|
|
# pull_request:
|
|
# branches: [ main ]
|
|
# types: [opened, synchronize, reopened]
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
sonarcloud:
|
|
name: SonarCloud
|
|
runs-on: ubuntu-latest
|
|
# Allow failures since SONAR_TOKEN may not be configured
|
|
continue-on-error: true
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
with:
|
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
|
|
|
- name: Check if SonarCloud token is set
|
|
id: check_token
|
|
run: |
|
|
if [ -z "${{ secrets.SONAR_TOKEN }}" ]; then
|
|
echo "SONAR_TOKEN is not set, skipping SonarCloud analysis"
|
|
echo "skip=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "skip=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: SonarCloud Scan
|
|
if: steps.check_token.outputs.skip != 'true'
|
|
uses: SonarSource/sonarqube-scan-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
with:
|
|
args: >
|
|
-Dsonar.projectKey=wpallstars_wp-plugin-starter-template-for-ai-coding
|
|
-Dsonar.organization=wpallstars
|
|
-Dsonar.sources=.
|
|
-Dsonar.tests=tests
|
|
-Dsonar.sourceEncoding=UTF-8
|
|
-Dsonar.cpd.exclusions=tests/**
|
|
-Dsonar.exclusions=vendor/**,node_modules/**,tests/**,bin/**,build/**,dist/**,.github/**,.git/**,cypress/**,playground/**,.wiki/**
|
|
-Dsonar.php.coverage.reportPaths=coverage.xml
|
|
-Dsonar.php.tests.reportPath=test-report.xml
|
|
-Dsonar.verbose=true
|