Update uBlacklist subscription weekly #1132
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: Update uBlacklist subscription weekly | |
on: | |
schedule: | |
- cron: "0 0 * * 0" | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
#if: github.event.repository.owner.id == github.event.sender.id | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.17.0' | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
submodules: recursive | |
- name: Merge txt | |
run: | | |
cp source/gyli/Blocklist/BLOCKLIST_uBlacklist source/gyli/Blocklist/blocklist.txt | |
rm uBlacklist.txt | |
rm uBlocklist.txt | |
rm tools/uBlacklist_backup.txt | |
rm source/gyli/Blocklist/blocklist.txt | |
rm source/Paxxs/Google-Blocklist/data -rf | |
rm source/laylavish/uBlockOrigin-HUGE-AI-Blocklist/additional_list_nuclear.txt | |
rm source/laylavish/uBlockOrigin-HUGE-AI-Blocklist/list.txt | |
rm source/laylavish/uBlockOrigin-HUGE-AI-Blocklist/list_uBlacklist_nuclear.txt | |
rm source/laylavish/uBlockOrigin-HUGE-AI-Blocklist/noai_hosts.txt | |
mv reverse_url.txt tools/reverse_url | |
find . -type f -name "*.txt" -exec cat {} \;> tools/uBlacklist | |
# Issue # 48 | |
sed -i '/^http:\/\//d' source/zweie/some-rules-for-ublacklist/Annoyingbastard.txt | |
cd tools | |
mv uBlacklist uBlacklist.txt | |
go run main.go | |
cat -s uBlacklist.txt | sed '/^[[:space:]]*$/d' | |
mv uBlacklist.txt ../uBlacklist.txt -f | |
cd .. | |
sed -i '/^#/d' uBlacklist.txt | |
sed -i '/^!/d' uBlacklist.txt | |
cat tools/reverse_url >> uBlacklist.txt | |
sed -i "1i\! Update weekly at $(TZ=UTC-8 date +'%Y-%m-%d %T %z')" uBlacklist.txt | |
ln -s uBlacklist.txt uBlocklist.txt | |
- name: Get Time | |
run: | | |
echo "CURRENT_TIME=$(TZ=UTC-8 date +'%Y-%m-%d %T %z')" >> $GITHUB_ENV | |
- name: Commit files | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: "ci(build): update weekly at ${{ env.CURRENT_TIME }}" | |
committer_name: 'github-actions[bot]' | |
committer_email: 'github-actions[bot]@users.noreply.github.com' | |
add: | | |
'uBlacklist.txt' | |
'tools/uBlacklist_backup.txt' |