-
Notifications
You must be signed in to change notification settings - Fork 7
88 lines (71 loc) · 2.53 KB
/
Copy pathpr-guard.yml
File metadata and controls
88 lines (71 loc) · 2.53 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
80
81
82
83
84
85
86
87
88
# © 2026 NetApp, Inc. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# See the NOTICE file in the repo root for trademark and attribution details.
name: PR Guard
on:
pull_request:
branches: [main]
permissions:
contents: read
pull-requests: read
jobs:
commitlint:
name: commitlint
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1
secrets:
name: secret-scan
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: TruffleHog scan
uses: trufflesecurity/trufflehog@20652fbbdefffcdaa493a5bf57ab2ac6b1db715b # v3.97.1
with:
extra_args: --only-verified
yaml-syntax:
name: Validate YAML syntax
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.11"
- name: Check changed YAML files
run: |
CHANGED_YAML=$(git diff --name-only --diff-filter=ACM origin/main...HEAD \
| grep '\.ya\?ml$' || true)
if [ -z "$CHANGED_YAML" ]; then
echo "No YAML files changed"
exit 0
fi
pip install -q -r requirements-dev.txt
ERRORS=0
while IFS= read -r f; do
if ! python -c "import yaml; yaml.safe_load(open('$f'))" 2>/dev/null; then
echo "::error file=$f::YAML syntax error in $f"
ERRORS=$((ERRORS + 1))
else
echo " OK $f"
fi
done <<< "$CHANGED_YAML"
[ "$ERRORS" -eq 0 ] || exit 1