👷 misc(release): ensure script is ran from default branch

main
welpo 7 months ago
parent c2519c51d6
commit 82f7a984d5
No known key found for this signature in database
GPG Key ID: A2F978CF4EC1F5A6

@ -10,6 +10,13 @@ exit_with_message() {
exit 1 exit 1
} }
# Run only from default branch.
default_branch=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "$default_branch" ]; then
exit_with_message "Not on $default_branch branch. Switch to $default_branch before running this script."
fi
# Check for a clean working directory. # Check for a clean working directory.
if [ -n "$(git status --porcelain)" ]; then if [ -n "$(git status --porcelain)" ]; then
exit_with_message "Your working directory is dirty. Commit or stash your changes before running this script." exit_with_message "Your working directory is dirty. Commit or stash your changes before running this script."

Loading…
Cancel
Save