Skip to content

V1.1.0

V1.1.0 #16

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Build Blocklist
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
pull_request:
paths:
- 'Lists/BLACKLIST.txt'
# 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
# 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
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #@v4.1.7
with:
ref: ${{ steps.extract_branch.outputs.branch }}
path: ${{ steps.extract_branch.outputs.branch }}
# Install python
- name: Install Python
uses: actions/setup-python@v5
# Remove the duplicated Blocklist domains
- name: Remove duplicated domains
run: python3 ${{ github.WORKSPACE }}/${{ steps.extract_branch.outputs.branch }}/scripts/remove_duplicated.py
# Run the Blocklist converter
- name: Build blocklist
run: python3 ${{ github.WORKSPACE }}/${{ steps.extract_branch.outputs.branch }}/scripts/update_lists.py
# Update the current Pull Request
- name: Update the Pull Request
run: |
git config --global user.name ${{ github.actor }}
git config --global user.email github-action@users.noreply.github.com
cd ${{ github.WORKSPACE }}/${{ steps.extract_branch.outputs.branch }}
for file in `ls ${{ github.WORKSPACE }}/${{ steps.extract_branch.outputs.branch }}/Lists/*.txt`; do
git add -f ${file}
done
git commit -m "Auto push blocklists formated from ${{ github.workflow }}"
git push origin ${{ steps.extract_branch.outputs.branch }}
env:
GITHUB_TOKEN: ${{ secrets.token }}