Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ jobs:

- name: Check for CHANGELOG file in commit
run: |
# Get files changed in this push/PR
# Get files changed in this push/PR.
# Use --diff-filter=ACMR so deletions don't count — removing a file
# shouldn't fail a rule that's checking for file presence.
if [ "${{ github.event_name }}" = "pull_request" ]; then
FILES=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || git diff --name-only ${{ github.event.pull_request.base.sha }} HEAD)
FILES=$(git diff --name-only --diff-filter=ACMR HEAD~1 HEAD 2>/dev/null || git diff --name-only --diff-filter=ACMR ${{ github.event.pull_request.base.sha }} HEAD)
else
FILES=$(git diff --name-only HEAD~1 HEAD)
FILES=$(git diff --name-only --diff-filter=ACMR HEAD~1 HEAD)
fi

echo "Changed files:"
echo "Changed files (added/modified/copied/renamed):"
echo "$FILES"

# Check if any code files changed (ignore docs-only)
Expand All @@ -44,7 +46,8 @@ jobs:
exit 0
fi

# Reject changelogs placed in repo root instead of changelogs/
# Reject changelogs placed in repo root instead of changelogs/.
# Only checks added/modified files (see --diff-filter above); pure deletions are allowed.
ROOT_CHANGELOG=$(echo "$FILES" | grep -E '^CHANGELOG-.*\.md$' || true)
if [ -n "$ROOT_CHANGELOG" ]; then
echo ""
Expand Down
24 changes: 24 additions & 0 deletions changelogs/CHANGELOG-ci-changelog-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# CI — Exclude Deletions from Changelog-Location Check

- Added `--diff-filter=ACMR` to both `git diff --name-only` invocations in the `check-changelog` job of `.github/workflows/deploy.yml`
- The job now only inspects Added / Copied / Modified / Renamed paths; pure deletions are ignored

---

## Summary
The `check-changelog` CI gate was firing on commits that **removed** a root-level `CHANGELOG-*.md` file. Because `git diff --name-only` returns the path of a file regardless of whether it was added, modified, or deleted, the regex `^CHANGELOG-.*\.md$` matched the deleted root-level changelog and the job failed with `❌ FAILED: Changelog found in repo root`.

This meant any legitimate cleanup commit that moved a stray root changelog into `changelogs/` (or removed an identical duplicate) would be blocked — the very kind of fix the rule wants to encourage.

## 1. Workflow Fix
**Files:** `.github/workflows/deploy.yml`
**What:** Both `git diff` calls in the `check-changelog` step now pass `--diff-filter=ACMR`, restricting the file list to Added / Copied / Modified / Renamed entries. Deletions are excluded.
**Impact:** Cleanup commits that remove or move root-level changelogs into `changelogs/` no longer fail the gate. New violations (a fresh `CHANGELOG-*.md` added at the repo root) are still caught, because added files are kept in the filter.

---

## Files Changed (1 total)

| File | Lines Changed | Type |
|------|:---:|------|
| `.github/workflows/deploy.yml` | +8 −5 | Added `--diff-filter=ACMR` and updated step comment |
Loading