Skip to content

chore: Add CI check to prevent merge conflict markers in committed files #96

@kevalyq

Description

@kevalyq

🐛 Problem

Merge conflict markers (<<<<<<<, =======, >>>>>>>) were accidentally committed to the repository in README.md, which should have been caught by CI before merging.

Example:

<<<<<<< HEAD
# Sync with Translation.io (extract + compile)
=======
# Sync with Translation.io (requires TRANSLATION_IO_API_KEY in .env.local)
>>>>>>> origin/main

This indicates our CI pipeline is missing a check to prevent such issues from reaching the main branch.

🎯 Proposed Solution

Add a CI check that scans all files for merge conflict markers before allowing a PR to be merged.

Implementation Options

Option 1: Add to preflight.sh script

# Check for merge conflict markers
if git grep -n -E "^(<<<<<<<|=======|>>>>>>>)" -- ':!*.md' ':!docs/**'; then
  echo "❌ Merge conflict markers found!"
  exit 1
fi

Option 2: Add dedicated GitHub Action

name: Check for Merge Conflicts

on:
  pull_request:
    branches: [main]

jobs:
  check-conflicts:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Check for merge conflict markers
        run: |
          if git grep -n -E '^(<<<<<<<|=======|>>>>>>>)' -- ':!*.md' ':!docs/**'; then
            echo "::error::Merge conflict markers found in files"
            exit 1
          fi

Option 3: Pre-commit hook

# In .git/hooks/pre-commit
if git diff --cached | grep -E '^\+.*(<<<<<<<|=======|>>>>>>>)'; then
  echo "❌ Merge conflict markers detected!"
  exit 1
fi

✅ Acceptance Criteria

  • CI pipeline detects merge conflict markers in all text files
  • Check runs on every PR before merge
  • Clear error message indicating which files contain conflicts
  • Documented in CONTRIBUTING.md
  • Added to scripts/preflight.sh for local validation
  • Optional: Add to pre-commit hook setup

📝 Additional Context

This issue was discovered during PR creation for Issue #67 (PWA Phase 3 features). The merge conflict was in README.md line 72-76.

Priority: Medium
Effort: Small (~30 minutes)
Labels: chore, ci, developer-experience

🔗 Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions