Import ShadowWhisperer #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Import ShadowWhisperer | |
on: | |
schedule: | |
- cron: '*/59 * * * *' | |
env: | |
GIT_NAME: 'spirillen' | |
GIT_EMAIL: '[email protected]' | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
jobs: | |
import_shadowwhisperer: | |
runs-on: ubuntu-24.04 [Beta] | |
steps: | |
- uses: actions/checkout@main | |
name: Clone repository | |
with: | |
token: '${{ secrets.GITHUB_TOKEN }}' | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Download ShadowWhisperer Adult list | |
run: wget -O /tmp/adult.ShadowWhisperer https://raw.githubusercontent.com/ShadowWhisperer/BlockLists/master/RAW/Adult | |
- name: Compare and output unique lines | |
run: | | |
python3 -c " | |
import csv | |
import os | |
def read_csv(file_path): | |
with open(file_path, 'r') as file: | |
return set(line.strip() for line in file) | |
adult_list = read_csv('source/porn_filters/imported/adult.ShadowWhisperer') | |
explicit_content = read_csv('source/porn_filters/explicit_content/wildcard.csv') | |
strict_filters = read_csv('source/strict_filters/wildcard.csv') if os.path.exists('source/strict_filters/wildcard.csv') else set() | |
unique_lines = adult_list - explicit_content - strict_filters | |
with open('source/porn_filters/imported/adult.ShadowWhisperer.unique', 'w') as output_file: | |
for line in unique_lines: | |
output_file.write(line + '\n') | |
" | |
- name: Git Status | |
run: git status | |
- name: Commit changes | |
continue-on-error: true | |
run: | | |
tag=$(date +'day: %j of year %Y %H:%M:%S') | |
git config --local user.email "$GIT_EMAIL" | |
git config --local user.name "$GIT_NAME" | |
git commit -m "Committed new lists $tag" -a | |
git pull --rebase | |
- name: Push changes | |
continue-on-error: true | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |