Skip to content

Sonar

Sonar #811

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@v2
- 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: Setup go
uses: actions/setup-go@v1
with:
go-version: 1.20.x
- name: Build with npm
run: |
go build -v .
go test -v -coverprofile cover.out
- name: SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
SONAR_TOKEN: '${{ secrets.SONAR_TOKEN }}'
with:
args: >
-Dsonar.organization=mastercard
-Dsonar.projectKey=Mastercard_oauth1-signer-go
-Dsonar.projectName=oauth1-signer-go
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.go.coverage.reportPaths=./cover.out
-Dsonar.exclusions=**/*_test.go,**/vendor/**,**/testdata/*
-Dsonar.test.inclusions=**/*_test.go
-Dsonar.test.exclusions=**/vendor/** -Dsonar.login=${{
secrets.SONAR_TOKEN }}