generated from IliyanKostov9/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (75 loc) · 2.3 KB
/
security-scan.yaml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Security scanning
on:
pull_request:
branches:
- master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
jobs:
checkout:
name: Checkout repo
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Save repo to artifact
uses: actions/upload-artifact@v4
with:
name: phd-portal-server
path: .
overwrite: true
if-no-files-found: error
retention-days: 1
include-hidden-files: true
scanning:
name: Scan for security checks
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
strategy:
fail-fast: false
matrix:
java_version: [21]
steps:
- name: Download repo artifact
uses: actions/download-artifact@v4
with:
name: phd-portal-server
path: .
- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java_version }}
distribution: "zulu"
- name: GitGuardian scan
uses: GitGuardian/[email protected]
env:
GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }}
GITHUB_PUSH_BASE_SHA: ${{ github.event.base }}
GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}
# - name: Cache SonarCloud packages
# uses: actions/cache@v4
# with:
# path: ~/.sonar/cache
# key: ${{ runner.os }}-sonar
# restore-keys: ${{ runner.os }}-sonar
#
# - name: Cache Gradle packages
# uses: actions/cache@v4
# with:
# path: ~/.gradle/caches
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
# restore-keys: ${{ runner.os }}-gradle
#
# - name: Make gradlew executable
# run: chmod +x ./gradlew
#
# - name: Build and analyze
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# run: ./gradlew build sonar --info