All checks were successful
Update Filter Lists / cgps (push) Successful in 5m14s
102 lines
3.1 KiB
YAML
102 lines
3.1 KiB
YAML
name: Update Filter Lists
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "57 02 * * *" # whatever
|
|
- cron: "18 13 * * *" # whatever
|
|
- cron: "49 21 * * *" # whatever
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
inputs:
|
|
dryrun:
|
|
description: 'Dry run or not, 1 is yes, 0 is not'
|
|
required: true
|
|
default: '0'
|
|
type: string
|
|
clear-list:
|
|
description: "Whether if clear the list (default: false)"
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
NODE_ENV: production
|
|
DRY_RUN: ${{ inputs.dryrun || '0' }}
|
|
|
|
jobs:
|
|
cgps:
|
|
runs-on: ha
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://git.xlion.tw/actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Install Bun
|
|
uses: https://github.com/oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
|
with:
|
|
bun-version-file: ".bun-version"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
bun install --cwd app --production --no-save
|
|
|
|
- name: Download allowlists
|
|
run: |
|
|
cd app
|
|
bun download_lists.js allowlist
|
|
env:
|
|
ALLOWLIST_URLS: |
|
|
https://raw.githubusercontent.com/AdguardTeam/HttpsExclusions/master/exclusions/banks.txt
|
|
https://git.xlion.tw/infra/dns-blocklist/raw/branch/main/whitelist.txt
|
|
|
|
- name: Download blocklists
|
|
run: |
|
|
cd app
|
|
bun download_lists.js blocklist
|
|
env:
|
|
BLOCKLIST_URLS: |
|
|
https://infra.pgs.xlion.dev/dns-blocklist-mirror/hagezi/pro.txt
|
|
https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/domains/native.tiktok.extended.txt
|
|
|
|
- name: Delete old rules and lists
|
|
if: ${{ inputs['clear-list'] == true && env.DRY_RUN != '1' }}
|
|
run: |
|
|
cd app
|
|
bun cf_gateway_rule_delete.js
|
|
bun cf_list_delete.js
|
|
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 }}
|
|
CGPS_DELETION_ENABLED: ${{ inputs.clear-list }}
|
|
|
|
- name: Create new rules and lists
|
|
run: |
|
|
cd app
|
|
bun cf_list_create.js
|
|
bun cf_gateway_rule_create.js
|
|
env:
|
|
BLOCK_PAGE_ENABLED: true
|
|
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 }}
|
|
DRY_RUN: ${{ env.DRY_RUN }}
|
|
|
|
- name: Send ping request
|
|
if: env.PING_URL != ''
|
|
run: |
|
|
curl "${{ env.PING_URL }}"
|
|
env:
|
|
PING_URL: ${{ secrets.PING_URL }}
|