Skip to content

Commit

Permalink
👷 misc(release): ensure script is ran from default branch
Browse files Browse the repository at this point in the history
  • Loading branch information
welpo committed Jul 24, 2024
1 parent c2519c5 commit 82f7a98
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions release
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ exit_with_message() {
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.
if [ -n "$(git status --porcelain)" ]; then
exit_with_message "Your working directory is dirty. Commit or stash your changes before running this script."
Expand Down

0 comments on commit 82f7a98

Please sign in to comment.