Block some malicious pcdn thx @wartaiwan24 #244
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: build Rule | |
on: | |
push: | |
branches: | |
- build | |
jobs: | |
execute_python_script: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Execute Python script | |
run: | | |
git clone "https://${{ github.actor }}:${{ secrets.TOKEN }}@github.com/${{ github.repository }}" -b build build | |
cd build | |
mkdir out | |
python main.py | |
cd out | |
mkdir Filters | |
cp -Rf AWAvenue-Ads-Rule-Adblock.txt AWAvenue-Ads-Rule.txt #历史遗留问题 | |
mv AWAvenue-Ads-Rule-* Filters/ | |
cd Filters | |
wget -O ./sing-box.tar.gz https://github.com/SagerNet/sing-box/releases/download/v1.8.2/sing-box-1.8.2-linux-amd64.tar.gz | |
tar -xzvf sing-box.tar.gz | |
chmod +x */sing-box | |
./*/sing-box rule-set compile AWAvenue-Ads-Rule-Singbox.json | |
./*/sing-box rule-set compile AWAvenue-Ads-Rule-Singbox-regex.json | |
rm -rf *sing-box* | |
ls | |
- name: Git push | |
run: | | |
git clone "https://${{ github.actor }}:${{ secrets.TOKEN }}@github.com/${{ github.repository }}" push | |
cp -Rf build/out/* push/ | |
cd push | |
files=$(find . -name '*AWAvenue*') | |
echo $files | |
if [[ -n "$(git diff -- $files)" ]] || [[ "$(echo $(git status) | grep 'Untracked files')" ]]; then | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add AWAvenue-Ads-Rule.txt | |
cd Filters | |
git add *AWAvenue* | |
git commit -m "${{ github.event.head_commit.message }}" | |
git push --set-upstream origin main | |
fi |