-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (66 loc) · 1.95 KB
/
Copy pathreusable-code-scanning.yml
File metadata and controls
79 lines (66 loc) · 1.95 KB
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
# This is a basic workflow to help you get started with Actions
name: "Centralized Code Scanning"
on:
workflow_call:
inputs:
languages:
required: true
type: string
build-command:
required: false
type: string
default: ''
jobs:
# Automatically run TFSec
tfsec-scan:
name: TFSec Scan
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Clone repo
uses: actions/checkout@v3
- name: Run tfsec
uses: aquasecurity/tfsec-sarif-action@9a83b5c3524f825c020e356335855741fd02745f
with:
sarif_file: tfsec.sarif
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: tfsec.sarif
# Run CodeQL Scan
codeql-scan:
name: CodeQL Scan
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ${{ fromJSON(inputs.languages) }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# Autobuild attempts to build the application for CodeQL
- name: Autobuild
if: ${{ inputs.build-command == '' }}
uses: github/codeql-action/autobuild@v2
# If the Autobuild command fails, pass a build command to the workflow using 'build-command' input
- name: Custom Build Command
if: ${{ inputs.build-command != '' }}
run: |
echo "Run, Build Application using script"
${{ inputs.build-command }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"