Add eslint and typescript checking 2 #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Base Branch | |
on: | |
pull_request: | |
pull_request_review: | |
types: [submitted] | |
jobs: | |
check-base-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check base branch | |
run: | | |
git fetch origin --prune | |
CURRENT_BRANCH=${{ github.head_ref }} | |
TARGET_BRANCH="${{ github.event.pull_request.base.ref }}" | |
COMMON_ANCESTOR=$(git merge-base origin/$CURRENT_BRANCH origin/$TARGET_BRANCH) | |
COMMITS_BEHIND=$(git rev-list --count origin/$TARGET_BRANCH ^$COMMON_ANCESTOR) | |
if [ "$COMMITS_BEHIND" -eq 0 ]; then | |
echo "Your branch is up-to-date with the target branch." | |
elif [ "$COMMITS_BEHIND" -eq 1 ]; then | |
echo "Your branch is 1 commit behind the target branch." | |
exit 1 | |
else | |
echo "Your branch is $COMMITS_BEHIND commits behind the target branch." | |
exit 1 | |
fi |