-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (37 loc) · 1.42 KB
/
code-scans.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Code Scans
on:
push:
branches: [ 'main', 'develop', 'support-*' ]
pull_request:
types: [opened, synchronize, reopened]
concurrency: code-scans-${{ github.ref }}
jobs:
buildAndTest:
name: Static Code Analysis
runs-on: ubuntu-latest
steps:
- name: Set branch name environment variable
uses: nelonoel/branch-name@v1.0.1
- uses: actions/checkout@v2
with:
# full checkout for SonarCloud analysis
fetch-depth: 0
- name: Set up Java 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
cache: 'gradle'
- name: SonarCloud Scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew clean build sonarqube -Dsonar.login=$SONAR_TOKEN
- name: Post Slack Update
if: ${{ failure() && ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/support-') ) }}
id: slack
uses: slackapi/slack-github-action@v1.14.0
with:
payload: "{\"Repo\":\"${{ github.repository }}\",\"Workflow\":\"${{ github.workflow }}\",\"Branch\":\"${{ env.BRANCH_NAME }}\",\"Link\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}