-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (31 loc) · 878 Bytes
/
cfn-nag.yml
File metadata and controls
33 lines (31 loc) · 878 Bytes
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
name: cfn-nag - CloudFormation Scan
on:
pull_request:
branches:
- main
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby 2.6
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
- name: Install cfn-nag
run: gem install cfn-nag
- name: Scan files in all templates folders
run: |
export deployment_dir=`pwd`
echo "$deployment_dir"
for i in $(find . -type f | grep -E '.template$|.yaml$|.yml$|.json$' | sed 's/^.\///') ; do
echo $i
if [[ "$i" == *"templates"* ]]; then
cfn_nag_scan --input-path "$deployment_dir/$i"
if [ $? -ne 0 ]; then
echo "cfn-nag failed validation - $i"
exit 1
fi
fi
done