-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github action to check if your branch is up to date
Check on PRs only Fix action trigger clean up variables, fetch origin
- Loading branch information
1 parent
9a9953a
commit 5b9118e
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: check-pr-merge | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
branches: | ||
- master | ||
- "release/*" | ||
jobs: | ||
check-merge: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Check if branch is up to date | ||
env: | ||
BASE_REF: ${{ github.base_ref }} | ||
run: | | ||
baseRef="origin/${BASE_REF}" | ||
echo "Targeting '$baseRef'" | ||
git fetch origin | ||
res=$(git --no-pager log HEAD..$baseRef --oneline) | ||
if [[ -z "$res" ]]; then | ||
echo "Branch is up to date with master" | ||
else | ||
echo "Branch is not up to date with master" | ||
echo "Please rebase your branch" | ||
exit 1 | ||
fi |