Compile CIDRs #8281
This file contains hidden or 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: Compile CIDRs | |
| on: | |
| schedule: | |
| - cron: '0 * * * *' # Runs every hour at minute 0 | |
| workflow_dispatch: # Allows manual trigger | |
| jobs: | |
| compile_cidrs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v3 | |
| with: | |
| persist-credentials: true # Needed for GitHub Actions to push changes | |
| - name: Set Up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.13' # Use your preferred Python version | |
| - name: Install Dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| - name: Run CIDR pull script | |
| env: | |
| PROXY: ${{ secrets.PROXY }} | |
| run: | | |
| python -m cidre.cli cidr pull --merge --proxy "$PROXY" | |
| - name: Check for Changes | |
| run: | | |
| git diff --quiet || echo "CHANGES_DETECTED=true" >> $GITHUB_ENV | |
| - name: Commit and Push Changes | |
| if: env.CHANGES_DETECTED == 'true' | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "[email protected]" | |
| git add . | |
| git commit -m "Auto-update CIDR data [$(date)]" | |
| git push | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |