Skip to content

Update branch-trigger.yml #9

Update branch-trigger.yml

Update branch-trigger.yml #9

Workflow file for this run

name: SAST
on:
push:
branches:
- main # or the name of your main branch
pull_request:
types: [opened, synchronize, reopened]
jobs:
run-sast:
name: Build and run SonarQube analysis
# Run on external PRs, but not on internal PRs since those will be run by push to branch
# if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '14'
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Build with Gradle Wrapper
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
arguments: build sonar --info