From f5b27beb5ddd6277e20857120efdcc42e5207b49 Mon Sep 17 00:00:00 2001 From: mpaulosky <60372079+mpaulosky@users.noreply.github.com> Date: Mon, 28 Sep 2026 18:25:08 -0700 Subject: [PATCH 1/3] ci: Lint Markdown survives force-pushes 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 --- .github/workflows/lint-markdown.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-markdown.yml b/.github/workflows/lint-markdown.yml index 52a8547f..ef9711b3 100644 --- a/.github/workflows/lint-markdown.yml +++ b/.github/workflows/lint-markdown.yml @@ -31,7 +31,8 @@ jobs: git fetch origin "${{ github.base_ref }}" --depth=1 files=$(git diff --name-only "origin/${{ github.base_ref }}..HEAD" -- '*.md') elif [[ "${{ github.event_name }}" == "push" ]]; then - if [[ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]]; then + # A new branch has no "before" commit, and a force-push leaves an unreachable one. + if ! git cat-file -e "${{ github.event.before }}^{commit}" 2>/dev/null; then files=$(git diff-tree --no-commit-id --name-only -r "${{ github.sha }}" -- '*.md') else files=$(git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" -- '*.md') From 767ebf7474a9206e8a135b3d2ea85b4f4425ea69 Mon Sep 17 00:00:00 2001 From: mpaulosky <60372079+mpaulosky@users.noreply.github.com> Date: Mon, 28 Sep 2026 18:29:29 -0700 Subject: [PATCH 2/3] ci: Lint the whole branch when the push has no usable base 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 --- .github/workflows/lint-markdown.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-markdown.yml b/.github/workflows/lint-markdown.yml index ef9711b3..6bf69f25 100644 --- a/.github/workflows/lint-markdown.yml +++ b/.github/workflows/lint-markdown.yml @@ -32,8 +32,9 @@ jobs: files=$(git diff --name-only "origin/${{ github.base_ref }}..HEAD" -- '*.md') elif [[ "${{ github.event_name }}" == "push" ]]; then # A new branch has no "before" commit, and a force-push leaves an unreachable one. + # Lint everything the branch changes since it left main, not just the tip commit. if ! git cat-file -e "${{ github.event.before }}^{commit}" 2>/dev/null; then - files=$(git diff-tree --no-commit-id --name-only -r "${{ github.sha }}" -- '*.md') + files=$(git diff --name-only "origin/main...${{ github.sha }}" -- '*.md') else files=$(git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" -- '*.md') fi From 07a387570032a9c175bbc38010282d78bfb23d58 Mon Sep 17 00:00:00 2001 From: mpaulosky <60372079+mpaulosky@users.noreply.github.com> Date: Mon, 28 Sep 2026 18:32:12 -0700 Subject: [PATCH 3/3] ci: Lint all tracked Markdown after a force-push to main 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 --- .github/workflows/lint-markdown.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-markdown.yml b/.github/workflows/lint-markdown.yml index 6bf69f25..277625d9 100644 --- a/.github/workflows/lint-markdown.yml +++ b/.github/workflows/lint-markdown.yml @@ -33,8 +33,13 @@ jobs: elif [[ "${{ github.event_name }}" == "push" ]]; then # A new branch has no "before" commit, and a force-push leaves an unreachable one. # Lint everything the branch changes since it left main, not just the tip commit. + # main itself has no base to compare against, so lint every tracked file there. if ! git cat-file -e "${{ github.event.before }}^{commit}" 2>/dev/null; then - files=$(git diff --name-only "origin/main...${{ github.sha }}" -- '*.md') + if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then + files=$(git ls-files '*.md') + else + files=$(git diff --name-only "origin/main...${{ github.sha }}" -- '*.md') + fi else files=$(git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" -- '*.md') fi