mirror of
https://github.com/lord-alfred/ipranges.git
synced 2025-12-19 03:37:47 +00:00
improve commit in workflow
This commit is contained in:
16
.github/workflows/update.yml
vendored
16
.github/workflows/update.yml
vendored
@@ -51,14 +51,20 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git config --local user.email "$(git log --format='%ae' HEAD^!)"
|
||||
git config --local user.name "$(git log --format='%an' HEAD^!)"
|
||||
git remote add github "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
||||
git pull github ${GITHUB_REF} --ff-only
|
||||
|
||||
# Get name & email from 1st commit
|
||||
git config --local user.email "$(git log --format='%ae' --reverse | head -1)"
|
||||
git config --local user.name "$(git log --format='%an' --reverse | head -1)"
|
||||
|
||||
# try commit
|
||||
git add .
|
||||
if [ -z "$(git status --porcelain)" ]; then
|
||||
echo 'No changes'
|
||||
exit 0
|
||||
fi
|
||||
git commit -m "Update ip ranges"
|
||||
git commit -m "Auto-update ip ranges"
|
||||
|
||||
# push changes
|
||||
git remote add github "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
||||
git pull github ${GITHUB_REF} --ff-only
|
||||
git push github HEAD:${GITHUB_REF}
|
||||
|
||||
Reference in New Issue
Block a user