forked from PBH-BTN/BTN-Collected-Rules
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (33 loc) · 1.19 KB
/
combine-rules.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
name: Combine TXT Files
on:
push:
paths:
- '**.txt'
workflow_dispatch:
jobs:
combine-txt-files:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Create combine directory
run: mkdir -p combine
- name: Combine txt files
run: |
# Combine all .txt files except combine/alltmp.txt to avoid recursion
find . -name "*.txt" ! -path "./combine/alltmp.txt" ! -path "./combine/all.txt" -exec cat {} + > combine/alltmp.txt
sort -u combine/alltmp.txt -o combine/all.txt
# awk '!seen[$0]++' combine/alltmp.txt > combine/all.txt
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- name: Cleanup Rules and Merge ips to CIDR
run: java -cp ./tools/RuleCleaner.jar Main ./combine/all.txt
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add combine/all.txt
git diff-index --quiet HEAD || git commit -m 'Combine all txt files into combine/all.txt'
git push