Sync ASN.China.list #1
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 ASN.China.list | |
on: | |
schedule: | |
- cron: '10 10 * * *' # UTC时间为10:00,换算为北京时间18:00 | |
workflow_dispatch: # 允许手动触发工作流 | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Your Repository | |
uses: actions/checkout@v3 | |
- name: Fetch ASN.China.list from Source | |
run: | | |
# 定义目标文件的 URL 和本地路径 | |
FILE_URL="https://raw.githubusercontent.com/missuo/ASN-China/refs/heads/main/ASN.China.list" | |
LOCAL_PATH="Common/ASN.China.list" | |
# 下载目标文件 | |
curl -o $LOCAL_PATH $FILE_URL | |
- name: Commit and Push Changes | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
# 检查是否有文件更改 | |
if [ -n "$(git status --porcelain)" ]; then | |
git add ASN.China.list | |
git commit -m "Daily sync of ASN.China.list" | |
git push | |
else | |
echo "No changes detected, skipping commit." | |
fi |