Skip to content

[V4] Exceptions

[V4] Exceptions #183

Workflow file for this run

name: Linear History
on:
pull_request:
branches: ["modules"]
workflow_dispatch:
jobs:
check-linear-history:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
- name: Check for merge commits
run: |
BASE_REF=${{ github.base_ref || 'modules' }}
echo "Comparing against base: $BASE_REF"
git fetch origin $BASE_REF:$BASE_REF
MERGE_COMMITS=$(git rev-list --merges $BASE_REF..HEAD)
if [ -n "$MERGE_COMMITS" ]; then
echo "Error: Merge commits detected. libfork requires a linear history."
echo "Please rebase your branch onto $BASE_REF to remove merge commits."
echo ""
echo "Merge commits found:"
git log --merges --oneline $BASE_REF..HEAD
exit 1
else
echo "No merge commits detected. Linear history check passed."
fi