Skip to content

获取 Cloudflare 优选 IP #2887

获取 Cloudflare 优选 IP

获取 Cloudflare 优选 IP #2887

Workflow file for this run

name: 获取 Cloudflare 优选 IP
on:
schedule:
# 每小时运行一次
- cron: '0 * * * *'
workflow_dispatch: # 允许手动触发
jobs:
fetch-ips:
runs-on: ubuntu-latest
permissions:
contents: write # 允许写入仓库内容
steps:
- name: 检出仓库
uses: actions/checkout@v4
- name: 获取 IP 列表
run: |
# 下载并提取 IP 地址
curl -s https://raw.githubusercontent.com/rdone4425/cf-speed-dns/refs/heads/main/ipTop10.html | \
grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' > cf_ips.txt
echo "提取到的 IP 地址:"
cat cf_ips.txt
- name: 提交更改
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add cf_ips.txt
git diff --quiet && git diff --staged --quiet || git commit -m "更新 Cloudflare 优选 IP - $(date '+%Y-%m-%d')"
- name: 推送更改
run: |
git push