Skip to content

Commit

Permalink
Pull in latest version of run-script-framework
Browse files Browse the repository at this point in the history
  • Loading branch information
pronovic committed Jan 1, 2025
1 parent e2b0fa7 commit 0c5ddac
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .run/commands/tagrelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ command_tagrelease() {
COPYRIGHT="${EARLIEST_YEAR}-${LATEST_YEAR}"
fi

DEFAULT_BRANCH=$(default_branch)
CURRENT_BRANCH=$(current_branch)
if [ "$CURRENT_BRANCH" != "$DEFAULT_BRANCH" ]; then
echo "*** You are not on $DEFAULT_BRANCH; you cannot release from this branch"
exit 1
Expand Down
17 changes: 14 additions & 3 deletions .run/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ task_help() {
fi
}

# Return the default Git branch
default_branch() {
# There is no canonical way to determine the default Git branch. This version is
# slow, but seems more reliable than most. At least by pulling it into a function
# (vs. a variable) only the commands or tasks that need it will take the hit.
# See: https://stackoverflow.com/questions/28666357/how-to-get-default-git-branch
LC_ALL=C git remote show $(git remote) | grep 'HEAD branch' | cut -d' ' -f5
}

# Return the current Git branch
current_branch() {
git branch -a | grep '^\*' | sed 's/^\* //'
}

# Setup the runtime environment
setup_environment() {
local EARLIEST_YEAR LATEST_YEAR
Expand All @@ -114,9 +128,6 @@ setup_environment() {

WORKING_DIR=$(mktemp -d)
trap "rm -rf '$WORKING_DIR'" EXIT SIGINT SIGTERM

DEFAULT_BRANCH=$(git config --get init.defaultBranch) # works on git > 2.28.0 from 2020
CURRENT_BRANCH=$(git branch -a | grep '^\*' | sed 's/^\* //')
}

# Add addendum information to the end of the help output
Expand Down
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Version 0.3.3 unreleased

* Add GitHub security policy in SECURITY.md.
* Pull in latest version of run-script-framework.
* Update dependencies to address Dependabot warnings.
* Upgrade to gha-shared-workflows@v7 with publish improvements.
* Add a default .pytest.ini file based on new cookiecutter template.
Expand Down

0 comments on commit 0c5ddac

Please sign in to comment.