Skip to content

Sonar

Sonar #1754

Workflow file for this run

name: Sonar
'on':
push:
branches:
- "**"
pull_request_target:
branches:
- "**"
types: [opened, synchronize, reopened, labeled]
schedule:
- cron: 0 16 * * *
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.0
with:
fetch-depth: 0
- name: Check for external PR
if: ${{ !(contains(github.event.pull_request.labels.*.name, 'safe') ||
github.event.pull_request.head.repo.full_name == github.repository ||
github.event_name != 'pull_request_target') }}
run: echo "Unsecure PR, must be labelled with the 'safe' label, then run the workflow again" && exit 1
- name: Use Node.js 24
uses: actions/setup-node@v6.4.0
with:
node-version: 24
- name: Build with npm
run: |
npm ci
npm run build --if-present
npm test
npm run coverage
- name: SonarCloud
uses: SonarSource/sonarqube-scan-action@v8.2.0
env:
SONAR_TOKEN: '${{ secrets.SONAR_TOKEN }}'
with:
args: >
-Dsonar.organization=mastercard
-Dsonar.projectName=oauth1-signer-nodejs
-Dsonar.projectKey=Mastercard_oauth1-signer-nodejs
-Dsonar.sources=./src
-Dsonar.tests=./test
-Dsonar.testExecutionReportPaths=test-results.xml
-Dsonar.javascript.lcov.reportPaths=.nyc_output/coverage.lcov