-
Notifications
You must be signed in to change notification settings - Fork 41
34 lines (30 loc) · 1.02 KB
/
linear.yml
File metadata and controls
34 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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