Skip to content

Commit bc9c0d2

Browse files
authored
Merge pull request #2 from Textagent/claude/zealous-goldberg-f31c40
ci: exclude deleted files from changelog-location check
2 parents 0dbad99 + 32093e3 commit bc9c0d2

2 files changed

Lines changed: 32 additions & 5 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ jobs:
2626

2727
- name: Check for CHANGELOG file in commit
2828
run: |
29-
# Get files changed in this push/PR
29+
# Get files changed in this push/PR.
30+
# Use --diff-filter=ACMR so deletions don't count — removing a file
31+
# shouldn't fail a rule that's checking for file presence.
3032
if [ "${{ github.event_name }}" = "pull_request" ]; then
31-
FILES=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || git diff --name-only ${{ github.event.pull_request.base.sha }} HEAD)
33+
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)
3234
else
33-
FILES=$(git diff --name-only HEAD~1 HEAD)
35+
FILES=$(git diff --name-only --diff-filter=ACMR HEAD~1 HEAD)
3436
fi
3537
36-
echo "Changed files:"
38+
echo "Changed files (added/modified/copied/renamed):"
3739
echo "$FILES"
3840
3941
# Check if any code files changed (ignore docs-only)
@@ -44,7 +46,8 @@ jobs:
4446
exit 0
4547
fi
4648
47-
# Reject changelogs placed in repo root instead of changelogs/
49+
# Reject changelogs placed in repo root instead of changelogs/.
50+
# Only checks added/modified files (see --diff-filter above); pure deletions are allowed.
4851
ROOT_CHANGELOG=$(echo "$FILES" | grep -E '^CHANGELOG-.*\.md$' || true)
4952
if [ -n "$ROOT_CHANGELOG" ]; then
5053
echo ""
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# CI — Exclude Deletions from Changelog-Location Check
2+
3+
- Added `--diff-filter=ACMR` to both `git diff --name-only` invocations in the `check-changelog` job of `.github/workflows/deploy.yml`
4+
- The job now only inspects Added / Copied / Modified / Renamed paths; pure deletions are ignored
5+
6+
---
7+
8+
## Summary
9+
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`.
10+
11+
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.
12+
13+
## 1. Workflow Fix
14+
**Files:** `.github/workflows/deploy.yml`
15+
**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.
16+
**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.
17+
18+
---
19+
20+
## Files Changed (1 total)
21+
22+
| File | Lines Changed | Type |
23+
|------|:---:|------|
24+
| `.github/workflows/deploy.yml` | +8 −5 | Added `--diff-filter=ACMR` and updated step comment |

0 commit comments

Comments
 (0)