headroom/.github/workflows/merge-conflicts.yml
Tejas Chopra 6efd01f707
ci: concurrency-cancel Docker + Merge Conflicts to stop merge-spree pileups (#2138)
## Description
`docker.yml` builds a full multi-arch image on **every push to `main`**
with **no concurrency group**, so a merge spree stacks one build per
commit. Against the Free-plan **20 concurrent-job cap**, those long
builds hog the runner pool and starve the `CI` (`test`/`lint`/`build`)
jobs that PR merges actually depend on. This adds concurrency-cancel so
only the latest build per ref runs — `cancel-in-progress` scoped to
`main` so a release tag's publish (its own ref) is never killed. Same
fix for the per-PR **Merge Conflicts** check.

## Type of Change
- [x] Repo infrastructure / CI (no functional change)

## Changes Made
- `.github/workflows/docker.yml`: `concurrency: docker-${{ github.ref
}}`, cancel-in-progress on `main` only.
- `.github/workflows/merge-conflicts.yml`: per-PR concurrency-cancel.

## Testing
- [x] YAML validated (`yaml.safe_load` on both) — release/tag builds
unaffected (separate ref group).

## Real Behavior Proof
- Before: 24 merges → 24 stacked Docker builds queued against 20 slots.
- After: only the latest `main` Docker build runs; older superseded ones
auto-cancel; release publishes untouched.
2026-07-13 13:47:59 -04:00

34 lines
1 KiB
YAML

name: Merge Conflicts
# Reject unresolved Git merge-conflict markers committed into tracked files.
#
# This lives in its own workflow ON PURPOSE: ci.yml sets
# `on.pull_request.paths-ignore: ['**/*.md', ...]`, so a Markdown/CHANGELOG-only
# PR skips that workflow entirely. The conflict markers this guard exists to
# catch landed in CHANGELOG.md, so the check must run with no `paths-ignore`.
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: merge-conflicts-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
merge-conflicts:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v7
- name: Reject unresolved merge-conflict markers
run: |
if git grep -nI -E '^(<{7}|>{7}|\|{7})( |$)' -- .; then
echo "::error::Unresolved Git merge-conflict markers found in tracked files (see matches above)."
exit 1
fi
echo "No merge-conflict markers found."