-
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (77 loc) · 2.59 KB
/
update_patterns.yml
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
89
90
91
92
93
name: Update patterns
on:
schedule:
- cron: '0 0 * * *' # Run daily at midnight UTC
workflow_dispatch: # Allow manual trigger
jobs:
update-owasp-waf:
runs-on: ubuntu-latest
steps:
- name: 🚚 Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Full history to avoid shallow clone issues
- name: ⚙️ Set Up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: 📦 Cache Python Packages
id: cache-pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: 📥 Install Dependencies
if: steps.cache-pip.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
continue-on-error: false # Fail the workflow if dependencies fail to install
- name: 🕷️ Run OWASP Scraper
run: |
python owasp.py
continue-on-error: false
- name: 🔄 Convert OWASP to Caddy WAF
run: |
python owasp2caddy.py
continue-on-error: false
- name: 🔄 Convert OWASP to Nginx WAF
run: |
python owasp2nginx.py
continue-on-error: false
- name: 🔄 Convert OWASP to Apache WAF
run: |
python owasp2apache.py
continue-on-error: false
- name: 🔄 Convert OWASP to Traefik WAF
run: |
python owasp2traefik.py
continue-on-error: false
- name: 🔄 Convert OWASP to HAProxy WAF
run: |
python owasp2haproxy.py
continue-on-error: false
- name: 🔄 Generate Bad Bot Blockers
run: |
python badbots.py
continue-on-error: false
# Ensure conf files are pushed even if no changes detected
- name: 🚀 Commit and Push Caddy and Nginx WAF Configs
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Update: [$(date)]" || echo "No changes to commit"
git push
continue-on-error: true # Continue even if no changes are made
- name: 🧹 Cleanup Cache (Optional)
run: |
rm -rf ~/.cache/pip
if: always() # Run this step even if previous steps fail
- name: 🚨 Notify on Failure (Optional)
if: failure()
run: |
echo "🚨 Workflow failed! Please investigate."
# Slack or email notification logic (add webhook or SMTP integration here)