21 lines
447 B
Bash
21 lines
447 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
: "${BRANCH:?BRANCH is required}"
|
|
: "${FILE:?FILE is required}"
|
|
: "${COMMIT_MESSAGE:?COMMIT_MESSAGE is required}"
|
|
|
|
git config user.name "gitea actions"
|
|
git config user.email "actions@localhost"
|
|
|
|
git checkout -B "$BRANCH"
|
|
git add "$FILE"
|
|
|
|
if git diff --cached --quiet; then
|
|
echo "No staged changes for ${FILE}; skipping commit"
|
|
exit 0
|
|
fi
|
|
|
|
git commit -m "$COMMIT_MESSAGE"
|
|
git push --force origin "$BRANCH"
|