Sync ASN.China.list #2
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: '0 10 * * *' # 每天 UTC 10:00(北京时间18:00) | |
workflow_dispatch: # 支持手动触发 | |
jobs: | |
sync: | |
runs-on: ubuntu-24.04 # 明确指定运行环境 | |
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" | |
# 创建目标目录并下载文件 | |
mkdir -p $(dirname $LOCAL_PATH) | |
curl -fSL $FILE_URL -o $LOCAL_PATH || (echo "File download failed!" && exit 1) | |
- 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 Common/ASN.China.list | |
git commit -m "Daily sync of ASN.China.list" | |
git push | |
else | |
echo "No changes detected, skipping commit." |