Skip to content

AdRules

AdRules #2267

Workflow file for this run

name: AdRules
on:
workflow_dispatch:
# push:
# branches:
# - "Her"
# paths-ignore:
# - "LICENSE"
# - "*.md"
# - "**/*.md"
# - ".*"
# - "node_modules"
schedule:
- cron: 0 */24 * * *
jobs:
Update:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [14]
steps:
- name: Fetch repository
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: yarn install, update
run: |
yarn install
yarn update-adrules
- name: Merge and Rules and remove duplicates
run: |
curl -LR -o RuleSet/AdRules/uBlack.list "https://raw.githubusercontent.com/dallaslu/penzai-list/main/Surge.txt"
awk 'FNR==1{print ""}{print}' RuleSet/AdRules/*.list > RuleSet/AdRules/Merge.txt
awk '!seen[$0]++' RuleSet/AdRules/Merge.txt > RuleSet/AdRules/Merge.list
grep -v -f RuleSet/AdRules/Bypass.list RuleSet/AdRules/Merge.list | sed '/^$/d; /\*/d' > RuleSet/AdRule.list
rm -rf RuleSet/AdRules/Merge.txt
rm -rf RuleSet/AdRules/Merge.list
- name: Download ChinaIPs.list
run: |
curl -LR -o RuleSet/ChinaIPs.txt "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/ChinaIPs/ChinaIPs.list"
awk 'FNR==1{print ""}{print}' RuleSet/ChinaIPs.txt | grep -v "#" | sed '/^$/d' > RuleSet/ChinaIPs.list
rm -rf RuleSet/ChinaIPs.txt
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: commit, push
uses: EndBug/add-and-commit@v9
with:
add: "-A"
author_name: 翠花
author_email: [email protected]
message: "Update AdRules"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}