Skip to content

Update Fail2Ban banned IPs #118

Update Fail2Ban banned IPs

Update Fail2Ban banned IPs #118

Workflow file for this run

name: Update Fail2Ban banned IPs
on:
schedule:
- cron: '0 */2 * * *'
workflow_dispatch:
permissions:
contents: write
jobs:
update-banned:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.SECRET_TOKEN }}
path: malicious_ips
- name: Run update script
run: bash ~/script.sh
- name: Commit and push updated IP list
working-directory: malicious_ips
run: |
cd ~/malicious_ips && git pull
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 "[auto]Update banned IPs every 2 hours $(date -u +'%Y-%m-%d %H:%M:%S UTC')"
git push