GitHub Actions: Don't trigger SonarCloud for PRs but workflow_dispatch
They turns green if the PR comes from an outside collaborator because all steps are skipped if the SONAR_TOKEN is not set. I'd rather not run static analysis on PRs overall than having it turn out green.
This commit is contained in:
parent
f00f157bfb
commit
fa355cbdcc
|
@ -2,9 +2,8 @@ name: SonarCloud
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master, development, development-v3 ]
|
branches: [ master, development ]
|
||||||
pull_request:
|
workflow_dispatch:
|
||||||
types: [ opened, synchronize, reopened ]
|
|
||||||
|
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
|
|
||||||
|
@ -18,23 +17,19 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
if: ${{ env.SONAR_TOKEN != null }}
|
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Prepare Workspace
|
- name: Prepare Workspace
|
||||||
if: ${{ env.SONAR_TOKEN != null }}
|
|
||||||
uses: ./.github/actions/setup_project_workspace
|
uses: ./.github/actions/setup_project_workspace
|
||||||
|
|
||||||
- name: 'Cache: SonarCloud'
|
- name: 'Cache: SonarCloud'
|
||||||
if: ${{ env.SONAR_TOKEN != null }}
|
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.sonar/cache
|
path: ~/.sonar/cache
|
||||||
key: ${{ runner.os }}-sonar
|
key: ${{ runner.os }}-sonar
|
||||||
|
|
||||||
- name: Analyze project
|
- name: Analyze project
|
||||||
if: ${{ env.SONAR_TOKEN != null }}
|
|
||||||
run: >
|
run: >
|
||||||
mvn -B \
|
mvn -B \
|
||||||
verify \
|
verify \
|
||||||
|
|
Loading…
Reference in New Issue