Port schedule-posts.py to pulumi-social-core wrapper#18667
Port schedule-posts.py to pulumi-social-core wrapper#18667adamgordonbell merged 2 commits intomasterfrom
Conversation
Refactor the 1054-line monolith into a ~180-line wrapper that imports shared scheduling logic from pulumi-social-core (pulumi/social@v0.1.0) as a uv git-dep. The wrapper owns only docs-specific concerns: - Account/API-target config (PROD_MODE, USER, LINKEDIN_PAGE_ID, SITE_URL) - build_entries callback — parses Hugo frontmatter, derives slug/URL, resolves meta.png for LinkedIn media attachments - CLI dispatcher (--post, --check, default schedule mode) Everything else — S3 state, upload-post.com API calls, PR comments, per-platform payload construction, char-limit detection, PR-number lookup, retries/abandonment, step summaries, failure summary file — now lives in social_core. This eliminates drift between pulumi/docs and pulumi/social copies. Net: -955 lines removed, +80 added in this file; total 179 lines. Validation performed locally before merging: - uv resolves pulumi-social-core git-dep (14 packages installed) - DRY_RUN parity against monolith on 21 blog posts — same scheduling decisions, cosmetic stdout differences only - --check parity against origin/master~50 — same posts identified, same per-platform char counts and copy - --post parity on synthetic post — identical payload shape on all three platforms - Live end-to-end against pulumi-test accounts: Bluesky, X, and LinkedIn each successfully posted via the wrapper path
Review summaryThis is a thorough refactor: 1054-line monolith → 179-line wrapper, with detailed pre-merge validation (DRY_RUN parity, The change is infrastructure code ( Observations
VerdictSolid refactor. The validation matrix in the PR body (DRY_RUN parity, check parity, post parity, live E2E) is what makes this mergeable despite touching ~1000 lines. The single behavior regression is captured as a non-blocking follow-up on the right side of the boundary. No blocking issues from a docs-review perspective. Recommend proceeding once Mention @claude if you'd like another pass or fixes applied. |
The refactored schedule-posts.py pulls social_core as a uv git-dep from pulumi/social (private). Without credentials, uv's git clone fails with "could not read Username for https://github.com: terminal prompts disabled". Add a setup step after setup-uv in both workflows that configures git's insteadOf with PULUMI_BOT_TOKEN from the existing ESC environment, matching the standard pattern used elsewhere for private-repo access.
Social Media ReviewNo blog posts with social copy found in this PR — it's a code change, not a content change. Nothing to review. |
|
Your site preview for commit 1149381 is ready! 🎉 http://www-testing-pulumi-docs-origin-pr-18667-11493811.s3-website.us-west-2.amazonaws.com |
Summary
Refactor
scripts/social/schedule-posts.pyfrom a 1054-line monolith into a ~180-line wrapper that imports shared scheduling logic frompulumi-social-core(https://github.com/pulumi/social@v0.1.0) as auvgit-dep. Eliminates drift between the copies inpulumi/docsandpulumi/social.What the wrapper owns
PROD_MODE,USER,LINKEDIN_PAGE_ID,SITE_URL)build_entriescallback — parses Hugo frontmatter, derives slug + URL, resolvesmeta.png/meta.jpgfor LinkedIn media attachments--post,--check, default schedule mode)What moved to
social_coreS3 state, upload-post.com API calls, PR comments, per-platform payload construction, char-limit detection, PR-number lookup, retries/abandonment, step summaries, failure-summary file.
Net diff
scripts/social/schedule-posts.py: -955 lines, +80 lines (1054 → 179 lines)Pre-merge validation (performed locally)
uvresolvespulumi-social-core @ git+https://github.com/pulumi/social.git@v0.1.0cleanly (14 packages installed).--checkparity againstorigin/master~50— same posts identified, same per-platform char counts and copy.--postparity on synthetic test post — identical payload shape on all three platforms.pulumi-testaccounts — Bluesky, X, and LinkedIn each successfully posted via the wrapper path (one test post per platform, test posts visible on thepulumi-test*accounts).CI / authentication notes
uvresolves the private git-dep usingPULUMI_BOT_TOKENvia the existinggit config url."https://x-access-token:${TOKEN}@github.com/".insteadOf "https://github.com/"pattern in bothschedule-social.ymlandclaude-social-review.yml. No workflow changes needed — sameuv runentrypoint.PROD_MODE = Falsepreserved (matches currentmasterbehavior; docs posts go topulumi-testaccounts).Test plan
claude-social-review.ymlruns on this PR — validates--checkmode + uv git-dep resolution in CI.schedule-social.ymlrun onmasterexercises full schedule mode end-to-end.Follow-ups (not blocking)
social_core.run_post_filereturns 0 even when a platform's copy is over the limit; the monolith exited 1. Only affects interactive--postuse (no CI path uses--post). Can patch viasocial_corev0.1.1 if desired.🤖 Generated with Claude Code