[V4] Exceptions #177
This file contains hidden or 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
| 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 | |