Skip to content

Compile new rules

Compile new rules #500

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Compile new rules
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
schedule:
- cron: '30 15 * * *'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions: # Job-level permissions configuration starts here
contents: write # 'write' access to repository contents
pull-requests: write # 'write' access to pull requests
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
name: checkout repo
with:
ref: 'rules'
# Setup Node.js
- uses: actions/setup-node@v4
name: setup node.js
# Install the hostlist-compiler
- run: npm i -g @adguard/hostlist-compiler
# Compiling blacklists
- run: wget "https://raw.githubusercontent.com/showgood163/AdguardHome-Rules/main/rules.json"
- run: hostlist-compiler -c ./rules.json -o ./blockrules.txt
# Commit compiled files
- name: Commit files
run: |
git add ./blockrules.txt
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -m "Update rules"
# Push commits
- uses: ad-m/github-push-action@master
name: Push changes
with:
branch: 'rules'