-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.49 KB
/
pr-security.yml
File metadata and controls
56 lines (48 loc) · 1.49 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
name: PR Security
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
semgrep:
name: Semgrep (SAST)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Semgrep
run: pipx install semgrep || pip install --user semgrep
- name: Run Semgrep (auto rules)
env:
# Optional; without it, results still show in job logs
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
run: |
semgrep ci --config auto
checkov:
name: Checkov (IaC)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Detect Terraform folder
id: detect_tf
run: |
if [ -d infra/terraform ]; then
echo "has_tf=true" >> "$GITHUB_OUTPUT"
else
echo "has_tf=false" >> "$GITHUB_OUTPUT"
fi
- name: Install Checkov
if: ${{ steps.detect_tf.outputs.has_tf == 'true' }}
run: pipx install checkov || pip install --user checkov
- name: Scan Terraform with Checkov
if: ${{ steps.detect_tf.outputs.has_tf == 'true' }}
run: |
checkov -d infra/terraform --quiet
- name: Skip (no infra/terraform found)
if: ${{ steps.detect_tf.outputs.has_tf != 'true' }}
run: |
echo "Skipping Checkov: no infra/terraform directory."