-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample-scheduled-audit.yml
More file actions
64 lines (56 loc) · 2.03 KB
/
Copy pathexample-scheduled-audit.yml
File metadata and controls
64 lines (56 loc) · 2.03 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
name: Scheduled Dockerfile Audit
on:
schedule:
# Run every Monday at 9 AM UTC
- cron: '0 9 * * 1'
workflow_dispatch: # Allow manual triggers
jobs:
audit:
runs-on: ubuntu-latest
name: Weekly Dockerfile Audit
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install LayerLint
run: |
curl -sSL https://raw.githubusercontent.com/vviveksharma/layerLint/main/install.sh | sh
- name: Find and scan all Dockerfiles
id: scan
run: |
echo "# LayerLint Weekly Audit Report" > report.md
echo "Generated: $(date)" >> report.md
echo "" >> report.md
FOUND_ISSUES=false
for dockerfile in $(find . -type f -name "Dockerfile*"); do
echo "## Scanning: $dockerfile" >> report.md
echo '```' >> report.md
if layerlint scan --dockerfile "$dockerfile" >> report.md 2>&1; then
echo "✅ No issues found" >> report.md
else
echo "❌ Issues detected" >> report.md
FOUND_ISSUES=true
fi
echo '```' >> report.md
echo "" >> report.md
done
echo "found_issues=$FOUND_ISSUES" >> $GITHUB_OUTPUT
- name: Create Issue if problems found
if: steps.scan.outputs.found_issues == 'true'
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const report = fs.readFileSync('report.md', 'utf8');
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: '⚠️ LayerLint Weekly Audit - Issues Detected',
body: report,
labels: ['dockerfile', 'audit', 'security']
});
- name: Upload report as artifact
uses: actions/upload-artifact@v3
with:
name: layerlint-audit-report
path: report.md
retention-days: 30