From 8df8a99737fc48c08f6db5304652ea068709056b Mon Sep 17 00:00:00 2001 From: Christopher Byrd Date: Thu, 18 Apr 2024 14:21:50 -0700 Subject: [PATCH] nit --- .github/workflows/check-base-branch.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-base-branch.yml b/.github/workflows/check-base-branch.yml index 1506134..ee0c9b0 100644 --- a/.github/workflows/check-base-branch.yml +++ b/.github/workflows/check-base-branch.yml @@ -17,12 +17,13 @@ jobs: run: | git fetch origin - CURRENT_BRANCH=$(echo "${{ github.ref }}" | cut -d'/' -f3) + CURRENT_BRANCH=$(echo "${{ github.ref }}" | sed 's|.*/||') TARGET_BRANCH="${{ github.event.pull_request.base.ref }}" - echo $CURRENT_BRANCH + COMMON_ANCESTOR=$(git merge-base $CURRENT_BRANCH origin/$TARGET_BRANCH) + COMMITS_BEHIND=$(git rev-list --count origin/main ^$COMMON_ANCESTOR) - COMMITS_BEHIND=$(git log --oneline origin/$TARGET_BRANCH ^$CURRENT_BRANCH) + echo $COMMITS_BEHIND if [ -n "$COMMITS_BEHIND" ]; then echo "Your branch is behind the target branch. The following commits are missing:"