Skip to content

Commit

Permalink
🧱 Set up commit presence check for the release branches
Browse files Browse the repository at this point in the history
  • Loading branch information
tiulpin committed Jan 22, 2024
1 parent 48154eb commit a55785e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/release-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Check PR Commits Against Main Branch

on:
pull_request:
branches:
- '2*'
pull_request_target:
branches:
- '2*'

jobs:
check-commits:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v2
with:
ref: 'main'

- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow

- name: Check if PR commits are in the main branch
run: |
PR_COMMITS=$(git log --format=format:%H origin/${{ github.head_ref }})
for COMMIT in $PR_COMMITS; do
if ! git merge-base --is-ancestor $COMMIT main; then
echo "::error::Commit $COMMIT is not in the main branch."
echo "Commit $COMMIT from the PR is not present in the main branch."
exit 1
fi
done
shell: bash

0 comments on commit a55785e

Please sign in to comment.