Update Fail2Ban banned IPs #19
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: Update Fail2Ban banned IPs | |
| on: | |
| schedule: | |
| - cron: '*/30 * * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-banned: | |
| runs-on: self-hosted | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PUSH_PAT }} | |
| path: malicious_ips | |
| - name: Run update script | |
| run: bash ~/script.sh | |
| - name: Commit and push updated IP list | |
| working-directory: malicious_ips | |
| run: | | |
| git add malicious_ips.txt | |
| if git diff --staged --quiet; then | |
| echo "Nothing to update." | |
| exit 0 | |
| fi | |
| git config user.name 'nixbear-actions' | |
| git config user.email ${{ secrets.GH_EMAIL }} | |
| git commit -m "Update banned IPs $(date -u +'%Y-%m-%d %H:%M:%S UTC')" | |
| git push |