Using the shell options -e, -u, and -o pipefail is generally good hygiene to catch errors. I ran into this when bumping Ruby versions for the first time because I rename the "origin" remote to "github" in my local checkouts. That caused the script to fail when setting defaultBranch and it attempted to plow ahead anyway which is not desirable since the rest of the script makes commits and pushes them.
The other change is to detect the name of the git remote linked to the current branch when running release.sh, which is probably "main" most of the time. This will fail when the current branch isn't tracking an upstream branch yet so if that's a common case the current code here won't work. I understand if you'd rather not bother with that change and I'll revert it or find an alternative method that doesn't rely on having the current branch tracking an upstream one if you're open to that.
Using the shell options
-e
,-u
, and-o pipefail
is generally good hygiene to catch errors. I ran into this when bumping Ruby versions for the first time because I rename the "origin" remote to "github" in my local checkouts. That caused the script to fail when settingdefaultBranch
and it attempted to plow ahead anyway which is not desirable since the rest of the script makes commits and pushes them.The other change is to detect the name of the git remote linked to the current branch when running
release.sh
, which is probably "main" most of the time. This will fail when the current branch isn't tracking an upstream branch yet so if that's a common case the current code here won't work. I understand if you'd rather not bother with that change and I'll revert it or find an alternative method that doesn't rely on having the current branch tracking an upstream one if you're open to that.