Der vorherige Commit (v1.125.1) fuegte "if: \${{ secrets.SONAR_TOKEN != '' }}" ein, um
den Sonar-Schritt bei fehlendem Secret zu ueberspringen. GitHub selbst lehnte den
Workflow damit komplett ab: 0-Sekunden-Fehlschlag, kein einziger Job-Log, "likely failed
because of a workflow file issue" -- live verifiziert, nicht nur vermutet.
Ersetzt durch reines continue-on-error: true ohne Bedingung auf demselben Schritt.
Erreicht dasselbe Ziel (fehlendes Secret oder nicht erreichbarer Sonar-Server reisst den
Workflow nicht mit runter), ohne den ungueltigen Ausdruck.
v1.125.2
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
59 lines
1.8 KiB
YAML
59 lines
1.8 KiB
YAML
name: Test and SonarQube
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
quality:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
# Full history so SonarQube can read blame data for new-code detection.
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: lts/*
|
|
cache: npm
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Type check
|
|
run: npm run type-check
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
- name: Unit tests
|
|
run: npm run test:unit
|
|
|
|
# SONAR_TOKEN ist als Repo-Secret nicht gesetzt (Stand 12.09.2026) -- ohne
|
|
# continue-on-error wuerde dieser Schritt sonst den ganzen Workflow rot faerben,
|
|
# obwohl Typecheck/Lint/Tests laengst gruen sind. Deckt gleichzeitig den Fall ab,
|
|
# dass der selbst gehostete SonarQube-Server mal nicht erreichbar ist. Ein "if:" auf
|
|
# "secrets.SONAR_TOKEN != ''" waere die naheliegende Alternative, macht den Workflow
|
|
# bei diesem Runner aber ungueltig (0s-Fehlschlag ohne jeden Job-Log) -- deshalb
|
|
# bewusst nur continue-on-error statt eines bedingten Schritts.
|
|
- name: SonarQube scan
|
|
continue-on-error: true
|
|
uses: SonarSource/sonarqube-scan-action@v8.1.0
|
|
env:
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
|
|
with:
|
|
args: >-
|
|
-Dsonar.projectKey=mARTin-B78_My-Weekly-ToDo-List_e038f066-0063-4a1e-9c33-03fdd5ab3c3a
|
|
-Dsonar.sources=src,scripts
|
|
-Dsonar.exclusions=**/node_modules/**,**/.next/**,**/*.spec.ts
|
|
-Dsonar.qualitygate.wait=true
|
|
-Dsonar.qualitygate.timeout=300
|