Skip to content

Add eslint and typescript checking 2 #19

Add eslint and typescript checking 2

Add eslint and typescript checking 2 #19

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
CURRENT_BRANCH=${{ github.ref }}
TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
echo $CURRENT_BRANCH
echo $TARGET_BRANCH
COMMON_ANCESTOR=$(git merge-base $CURRENT_BRANCH origin/$TARGET_BRANCH)
COMMITS_BEHIND=$(git rev-list --count origin/main ^$COMMON_ANCESTOR)
echo $COMMITS_BEHIND
if [ -n "$COMMITS_BEHIND" ]; then
echo "Your branch is behind the target branch. The following commits are missing:"
echo "$COMMITS_BEHIND"
exit 1
else
echo "Your branch is up to date with the target branch."
fi