-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 }} |