-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f895b4d
Showing
28 changed files
with
65,674 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: 清理仓库历史 | ||
|
||
on: | ||
workflow_dispatch: # 手动触发 | ||
schedule: | ||
- cron: '0 0 1 * *' | ||
|
||
jobs: | ||
cleanup: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 检出代码 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # 获取完整历史记录 | ||
|
||
- name: 配置 Git | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
- name: 清理历史提交 | ||
run: | | ||
# 获取三个月前的时间戳 | ||
CUTOFF_DATE=$(date -d "3 months ago" +%s) | ||
# 创建临时分支 | ||
git checkout --orphan temp_branch | ||
# 添加当前所有文件 | ||
git add -A | ||
# 创建新的提交 | ||
git commit -m "清理历史提交:保留最近三个月的记录" | ||
# 删除所有旧分支 | ||
git branch | grep -v "temp_branch" | xargs git branch -D | ||
# 将临时分支重命名为主分支 | ||
git branch -m main | ||
# 获取最新的标签 | ||
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null || echo "") | ||
# 删除所有标签 | ||
git tag | xargs git tag -d | ||
# 如果存在最新标签,则重新创建 | ||
if [ ! -z "$LATEST_TAG" ]; then | ||
git tag $LATEST_TAG | ||
fi | ||
# 强制推送更改 | ||
git push -f origin main | ||
git push -f --tags |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Update IPv6 Prefixes | ||
|
||
on: | ||
schedule: | ||
- cron: '*/15 * * * *' # 每15分钟运行一次 | ||
workflow_dispatch: # 允许手动触发 | ||
|
||
jobs: | ||
update-prefixes: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 检出代码 | ||
uses: actions/checkout@v3 | ||
|
||
- name: 设置Python环境 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: 安装依赖 | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install requests beautifulsoup4 | ||
- name: 运行IPv6提取脚本 | ||
run: python ipv6_extractor.py | ||
|
||
- name: 检查是否有更改 | ||
run: | | ||
git add . | ||
if git diff --cached --quiet; then | ||
echo "没有需要提交的更改" | ||
exit 0 | ||
fi | ||
- name: 提交并推送更改 | ||
if: success() | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git commit -m "Downloaded and processed files on $(date '+%Y/%m/%d %H:%M:%S')" || echo "没有需要提交的更改,跳过提交。" | ||
git pull --rebase | ||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | ||
git push || echo "没有需要推送的更改,跳过推送。" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: 优选域名和IP | ||
|
||
on: | ||
schedule: | ||
- cron: "0 16 1 * *" | ||
workflow_dispatch: # 允许手动触发 | ||
|
||
jobs: | ||
fetch_domains: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 检查出代码库 | ||
uses: actions/checkout@v3 | ||
|
||
- name: 设置 Python 环境 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: 安装依赖 | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install aiohttp | ||
- name: 获取域名列表 | ||
run: python fetch_domains.py | ||
|
||
- name: 上传域名列表 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: domain-list | ||
path: temp_domains.txt | ||
|
||
query_ips: | ||
needs: fetch_domains | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
query_method: [de_fra, google, quad9, twnic, uk_lon, sb, kr_sel, sg_sin, jp_nrt, hk_hkg] | ||
steps: | ||
- name: 检查出代码库 | ||
uses: actions/checkout@v3 | ||
|
||
- name: 设置 Python 环境 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: 安装依赖 | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install aiohttp beautifulsoup4 | ||
- name: 下载域名列表 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: domain-list | ||
|
||
- name: 查询IP地址 | ||
run: python query_ip.py ${{ matrix.query_method }} | ||
|
||
- name: 上传查询结果 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ip-results-${{ matrix.query_method }} | ||
path: ip_results_${{ matrix.query_method }}.txt | ||
|
||
optimize_results: | ||
needs: query_ips | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 检查出代码库 | ||
uses: actions/checkout@v3 | ||
|
||
- name: 设置 Python 环境 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: 安装依赖 | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install aiohttp ipaddress beautifulsoup4 | ||
- name: 下载所有查询结果 | ||
uses: actions/download-artifact@v3 | ||
|
||
- name: 匹配CIDR | ||
run: python main.py | ||
|
||
- name: 提交更改 | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add 优选域名.txt 优选域名ip.txt | ||
git commit -m "更新优选域名和IP" || echo "No changes to commit" | ||
git push |
Oops, something went wrong.