Sync Files #1723
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: Sync Files | |
on: | |
schedule: | |
- cron: "*/30 * * * *" | |
workflow_dispatch: | |
jobs: | |
sync_files: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Git | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Check out TutuBetterRules repository | |
uses: actions/checkout@v2 | |
with: | |
repository: bunizao/TutuBetterRules | |
ref: tutu | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download reject.list from Mirrored repository | |
run: | | |
curl -L -o reject.list https://github.com/bunizao/Mirrored/raw/main/Chores/ruleset/reject.list | |
- name: Download All-in-One-2.x.sgmodule from Mirrored repository | |
run: | | |
curl -L -o All-in-One-2.x.sgmodule https://github.com/bunizao/Mirrored/raw/main/Chores/sgmodule/All-in-One-2.x.sgmodule | |
- name: Copy files to TutuBetterRules repository structure | |
run: | | |
mkdir -p RuleList/DOMAlN | |
mkdir -p Surge/module | |
cp reject.list RuleList/DOMAlN/AD.Reject.list | |
cp All-in-One-2.x.sgmodule Surge/module/All-in-One-2.x.sgmodule | |
- name: Commit and push changes if any | |
run: | | |
git add RuleList/DOMAlN/AD.Reject.list Surge/module/All-in-One-2.x.sgmodule | |
if git diff --cached --quiet; then | |
echo "No changes to commit" | |
else | |
git commit -m "⟳💡Sync updated from upstream" | |
git push origin tutu | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |