Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
sefinek committed Sep 8, 2024
1 parent 8547165 commit d79809e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/fetch-ips.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@ jobs:
git status -s > changes.txt
echo "has_changes=$(cat changes.txt | wc -l)" >> $GITHUB_ENV
- name: Commit and push changes if necessary
if: env.has_changes != '0'
- name: Commit and push changes
run: |
git config user.name "Sefinek Actions"
git config user.email "[email protected]"
git add .
git commit -am "Update the list of malicious IP addresses"
git push origin main
if [ -n "$(git status -s)" ]; then
MODIFIED_FILES=$(git diff --name-only HEAD | grep -v '^cache/')
FILE_COUNT=$(echo "$MODIFIED_FILES" | wc -l)
if [ "$FILE_COUNT" -gt 0 ]; then
git commit -am "Bi-hourly update of blocklists [$FILE_COUNT files] - $(date -u '+%Y-%m-%d %H:%M:%S UTC')" -m "$MODIFIED_FILES"
git push origin main
else
echo "Canceled. No files to commit after excluding cache/ files."
fi
else
echo "Canceled. No changes to commit."
fi
env:
GITHUB_TOKEN: ${{ secrets.SEFINEK_ACTIONS_PAT }}

0 comments on commit d79809e

Please sign in to comment.