Skip to content

ci: Lint Markdown survives force-pushes - #139

Merged
mpaulosky merged 3 commits into
mainfrom
chore/lint-markdown-force-push
Sep 29, 2026
Merged

mpaulosky merged 3 commits into
mainfrom
chore/lint-markdown-force-push

Conversation

@mpaulosky

@mpaulosky mpaulosky commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

The Lint Markdown push job compares github.event.before with github.sha. After a force-push, before points at a commit the runner can't resolve, so git diff fails with fatal: bad object (seen on #138's rebase push). When the before commit is missing (a new branch or a force-push), the step now lints every Markdown file the branch changes since it left main (origin/main...<sha>), not only the tip commit.

This commit was meant for #138, but auto-merge squashed that PR two seconds before the commit reached GitHub.

Validation

  • yamllint .github/workflows/lint-markdown.yml: clean
  • Checked the new condition locally: the all-zeros SHA and an unknown SHA both take the fallback path, and a real commit takes the normal diff.
  • Simulated a two-commit branch: the fallback lists both commits' Markdown files; linting only the tip commit would have missed one.

🤖 Generated with Claude Code

A force-push leaves github.event.before pointing at a commit the runner
cannot resolve, so git diff failed with "bad object". Fall back to the
pushed commit's own files whenever the before commit is missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 01:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The fallback misses Markdown changed in earlier commits of a multi-commit force-push.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Updates Markdown linting to handle unresolved pre-push commits.

Changes:

  • Detects missing before commits with git cat-file.
  • Falls back to linting files from the pushed tip commit.
File Description
.github/​workflows/​lint-markdown.yml Adds force-push fallback handling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/lint-markdown.yml Resolved
@mpaulosky
mpaulosky enabled auto-merge (squash) September 29, 2026 01:28
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Test Results Summary

412 tests  +412   412 ✅ +412   13s ⏱️ +13s
  8 suites +  8     0 💤 ±  0 
  8 files   +  8     0 ❌ ±  0 

Results for commit 07a3875. ± Comparison against base commit 86e534f.

♻️ This comment has been updated with latest results.

A force-push that rewrites several commits would only have linted the tip
commit. Diff against the merge base with main instead, so every Markdown
change on the branch is checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 29, 2026 01:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The fallback produces an empty diff when force-pushing directly to main.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)

Comment thread .github/workflows/lint-markdown.yml Resolved
On main, origin/main is the pushed commit itself, so the merge-base diff
is empty. With no usable base there, lint every tracked Markdown file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 29, 2026 01:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The fallback now covers multi-commit rewritten branches and the special main case without reintroducing the previously reported gaps.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@codecov

codecov Bot commented Sep 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.82%. Comparing base (c240290) to head (07a3875).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #139   +/-   ##
=======================================
  Coverage   84.82%   84.82%           
=======================================
  Files          77       77           
  Lines        1562     1562           
  Branches      143      143           
=======================================
  Hits         1325     1325           
  Misses        180      180           
  Partials       57       57           

@mpaulosky
mpaulosky merged commit d1a214c into main Sep 29, 2026
25 checks passed
@mpaulosky
mpaulosky deleted the chore/lint-markdown-force-push branch September 29, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants