IP合集 #19
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: IP合集 | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
StatisticalIP: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/[email protected] | |
- name: 整理全部IP | |
run: | | |
mkdir -p Collection | |
find . -type f -name "*.txt" -not -name "multi-dial.txt" -not -name "ipv4_all.txt" -not -name "ipv6_all.txt" -not -name "IP_all.txt" -exec cat {} + | sort | uniq > Collection/ipv4_6.txt | |
- name: 分离IPv4 | |
run: | | |
cd Collection | |
grep -E "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" ipv4_6.txt > ipv4.txt | |
- name: 分离IPv6 | |
run: | | |
cd Collection | |
grep -vFf ipv4.txt ipv4_6.txt > ipv6.txt | |
- name: 优化目录 | |
run: | | |
mkdir -p List | |
mv \ | |
"0xde-0xad-0xbe-0xef.txt" \ | |
"123pan.txt" \ | |
"dt_torrent.txt" \ | |
"go.torrent dev 20181121.txt" \ | |
"hp_torrent.txt" \ | |
"multi-dial.txt" \ | |
List/ | |
- name: 安装python运行环境 | |
uses: actions/[email protected] | |
- name: 安装依赖_ipaddress | |
run: | | |
python -m pip install --upgrade pip | |
pip install ipaddress | |
- name: 使用Python脚本处理得到CIDR | |
run: | | |
mkdir -p CIDR | |
python CIDR.py -i "${{ github.workspace }}/Collection/ipv4.txt" -o "${{ github.workspace }}/CIDR" | |
python CIDR.py -i "${{ github.workspace }}/Collection/ipv6.txt" -o "${{ github.workspace }}/CIDR" | |
#- name: Set up branch name | |
# id: vars | |
# run: | | |
# TIMESTAMP=$(TZ='Asia/Shanghai' date +'%H%M%S') | |
# echo "BRANCH_NAME=$(date +'%Y-%m-%d')-$TIMESTAMP" >> $GITHUB_ENV | |
- name: Commit changes | |
run: | | |
git fetch origin | |
git checkout -b auto || git checkout auto | |
git config --local user.email "[email protected]" | |
git config --local user.name "github-actions" | |
git add . | |
if git diff-index --quiet HEAD; then | |
echo "No changes to commit" | |
else | |
git commit -m "自动生成[skip ci]" | |
git push origin auto | |
fi |