Skip to content

[fix-publish-workflow] auto-publish blog drafts on merge (fetch base.sha + squash-safe) - #102

Merged
Smetools merged 1 commit into
mainfrom
hassan/fix-publish-workflow
Jun 28, 2026
Merged

[fix-publish-workflow] auto-publish blog drafts on merge (fetch base.sha + squash-safe)#102
Smetools merged 1 commit into
mainfrom
hassan/fix-publish-workflow

Conversation

@Smetools

@Smetools Smetools commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Merged [blog-draft] PRs were not publishing. The find-drafts step diffs base.sha..head.sha but the checkout was shallow and base.sha was never fetched -> diff errored, '|| true' swallowed it -> 0 drafts -> 'Nothing to commit'. محضر اجتماع (#98) needed a manual publish (#101).

Fix: checkout fetch-depth: 0 (base.sha in history) + explicit fetch of head.sha (squash-safe) + --diff-filter=AM. Now every merged [blog-draft] PR auto-publishes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of blog draft publishing by using a more complete repository history to detect changed draft files correctly.
    • Made draft detection more resilient when comparing changes in pull requests, reducing the chance of missing newly merged draft content.

@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
knowcap-landing Building Building Preview, Comment Jun 28, 2026 3:23pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b2c1afd-ba7a-4bd8-8768-835853109919

📥 Commits

Reviewing files that changed from the base of the PR and between 8f80313 and ea90b00.

📒 Files selected for processing (1)
  • .github/workflows/publish-blog-draft.yml

📝 Walkthrough

Walkthrough

The publish-blog-draft.yml workflow is updated to use fetch-depth: 0 for full git history, and the draft file discovery script is refactored to derive BASE and HEAD from the PR event, explicitly fetch the PR head commit (tolerating failures), and compute changed draft markdown files via git diff $BASE $HEAD.

Changes

Publish Blog Draft Workflow

Layer / File(s) Summary
Full history fetch and draft discovery script
.github/workflows/publish-blog-draft.yml
fetch-depth changed to 0; draft discovery script rewritten to use BASE/HEAD from PR event, explicit git fetch of the PR head commit with failure tolerance, and git diff $BASE $HEAD for draft markdown detection.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

  • Knowcap-V2/knowcap-website#77: Originally introduced the publish-blog-draft.yml workflow with draft file discovery from PR context, which this PR directly modifies to fix the diff computation.

Poem

🐇 A rabbit once fetched with --depth of two,
And lost all the history it needed to chew.
Now fetch-depth: 0 brings the whole git tree,
BASE diffed against HEAD, as it ought to be!
No more shallow commits — the diffs run free! 🌿

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hassan/fix-publish-workflow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Smetools
Smetools merged commit f82c833 into main Jun 28, 2026
1 of 3 checks passed
@Smetools
Smetools deleted the hassan/fix-publish-workflow branch June 28, 2026 15:24
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.

1 participant