forked from mrrfv/cloudflare-gateway-pihole-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto_update_github_action.yml
74 lines (62 loc) · 1.99 KB
/
auto_update_github_action.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
name: Update Filter Lists
on:
schedule:
- cron: "0 3 * * 1"
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_ENV: production
jobs:
cgps:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: "mrrfv/cloudflare-gateway-pihole-scripts"
ref: "v1"
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install npm dependencies
run: npm ci
- name: Download allowlists
run: npm run download:allowlist
env:
ALLOWLIST_URLS: ${{ vars.ALLOWLIST_URLS }}
- name: Download blocklists
run: npm run download:blocklist
env:
BLOCKLIST_URLS: ${{ vars.BLOCKLIST_URLS }}
- name: Delete old rules and lists
run: npm run cloudflare-delete
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_LIST_ITEM_LIMIT: ${{ secrets.CLOUDFLARE_LIST_ITEM_LIMIT }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
FAST_MODE: ${{ vars.FAST_MODE }}
- name: Create new rules and lists
run: npm run cloudflare-create
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_LIST_ITEM_LIMIT: ${{ secrets.CLOUDFLARE_LIST_ITEM_LIMIT }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
FAST_MODE: ${{ vars.FAST_MODE }}
- name: Send ping request
if: env.PING_URL != ''
run: |
curl "${{ env.PING_URL }}"
env:
PING_URL: ${{ secrets.PING_URL }}
- name: Keep workflow alive
uses: gautamkrishnar/keepalive-workflow@v1