Skip to content

Commit

Permalink
chore(pre-push): Consider direct pushes to release branches when dete…
Browse files Browse the repository at this point in the history
…cting the base branch (#2678) (#2679)

Co-authored-by: Joongi Kim <joongi@lablup.com>
  • Loading branch information
lablup-octodog and achimnol authored Sep 4, 2024
1 parent 704dc39 commit fadea0f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/pre-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else
# Get the base branch name from GitHub if we are on a pull request.
BASE_BRANCH=$(gh pr view "$CURRENT_BRANCH" --json baseRefName -q '.baseRefName' 2>/dev/null)
if [[ -z "$BASE_BRANCH" ]]; then
BASE_BRANCH="main"
echo "No pull request found for the branch $CURRENT_BRANCH, falling back to main."
if [ -n "$(echo "$CURRENT_BRANCH" | sed -n '/^[[:digit:]]\{1,\}\.[[:digit:]]\{1,\}/p')" ]; then
# if we are on the release branch, use it as the base branch.
echo "We are on a release branch $CURRENT_BRANCH."
BASE_BRANCH="$CURRENT_BRANCH"
else
echo "No pull request found for the branch $CURRENT_BRANCH, falling back to main."
BASE_BRANCH="main"
fi
else
echo "Detected the pull request's base branch: $BASE_BRANCH"
fi
Expand Down

0 comments on commit fadea0f

Please sign in to comment.