name: build Rule on: push: branches: - build jobs: execute_python_script: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v2.5.0 - name: Set up Python uses: actions/setup-python@v2 with: python-version: 3.9 - name: Execute Python script run: | 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 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