Weekly URL Cleaning and Backup #34
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: Weekly URL Cleaning and Backup | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * 0" # Runs at 00:00 every Sunday | |
jobs: | |
clean-and-backup-urls: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: Clean and save URLs | |
run: python checker.py | |
- name: Sync to cleaned directory | |
run: python -c 'from checker import process_all_files; process_all_files("domains", "cleaned")' | |
- name: Sync to backup directory | |
run: python -c 'from checker import sync_files; sync_files("cleaned", "backup")' | |
- name: Configure Git | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
- name: Pull latest changes | |
run: git pull origin main | |
- name: Commit backup files | |
run: | | |
git add backup/* | |
git add cleaned/* | |
git commit -m "Backup cleaned URL files" || echo "No changes to commit" | |
git push |