Generate Blacklist #342
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: Generate Blacklist | |
on: | |
push: | |
branches: [ main ] | |
schedule: | |
- cron: 0 1 * * * | |
env: | |
TZ: Asia/Shanghai | |
jobs: | |
Generate_Blacklist: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@main | |
- name: Setup Python 3.9.x | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9.x' | |
- name: Install Dependencies | |
run: | | |
sudo timedatectl set-timezone "$TZ" | |
python -m pip install --upgrade pip | |
pip install requests tld tcping IPy | |
- name: Generate Blacklist | |
run: | | |
python blacklist.py | |
rm -rf __pycache__ | |
- name: Commit Changes | |
id: commit | |
run: | | |
if [ -z "$(git status --porcelain)" ]; then | |
exit 0 | |
else | |
echo "::set-output name=status::success" | |
git add . | |
git config --local user.email "[email protected]" | |
git config --local user.name "217heidai" | |
git commit -m "Updated at $(date)" -a | |
fi | |
- name: GitHub Push | |
if: steps.commit.outputs.status == 'success' && !cancelled() | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
- name: Delete Workflow Runs | |
uses: GitRML/delete-workflow-runs@main | |
with: | |
retain_days: 30 | |
keep_minimum_runs: 10 |