ci: reusable changeset-hygiene workflow#39
Merged
Conversation
Reusable workflow + script that any pnpm/changesets monorepo can call to surface changeset issues as a sticky PR comment. Never blocks the PR — output is informational. Detects: - packages modified but not declared in any changeset - changesets declaring packages that don't exist in the workspace (typo) - changesets declaring packages with no source changes - source modified but no changeset added at all - (opt-in via forbidden-major-packages input) major bumps for autoload-style packages where breaking changes break consumers
6 tasks
turnipdabeets
added a commit
to PostHog/posthog-android
that referenced
this pull request
May 4, 2026
…kflow Removes the local 169-line script and 85-line workflow in favor of a tiny 22-line caller delegating to PostHog/.github's reusable changeset-hygiene workflow (PostHog/.github#39). Same behavior, single source of truth across SDKs. Pinned to feat/changeset-hygiene while PostHog/.github#39 is open; will update to @main once that merges.
marandaneto
approved these changes
May 4, 2026
Piccirello
approved these changes
May 4, 2026
| - name: Setup Node | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: '22' |
Member
There was a problem hiding this comment.
nit: use node 24 since it's the current LTS?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a reusable workflow that any pnpm/changesets repo in the PostHog org can call to surface changeset coverage issues as a sticky PR comment. Always exits 0 — the comment is informational, never gates merging.
Why
A real bug in posthog-android (#491 → #507): a PR modified code in
posthog-android-gradle-plugin/but the changeset declaredposthog-android(the SDK package). The mistake silently slipped through because the directory name and the SDK package name look almost identical. The wrong package got bumped, the actual change never released, and a corrective changeset PR was needed.This workflow catches that class of mistake at PR-time. It also catches three other patterns:
How it works
workflow_callso each consumer repo has a tiny ~6-line caller that delegates here.pnpm m ls --json --depth=-1to discover workspace packages — handles globs, exclusions, and the catalog (e.g., posthog-js'spackages/*+tooling/*+!**/playground/**)..changeset/*.mdadded or modified in the PR.<!-- changeset-hygiene -->, with a collapsible<details open>body. Auto-deletes when a follow-up push resolves the issue.actions/github-script(no third-party deps) — same pattern as posthog-js's existingcheck-posthog-major-version.yml.Caller setup (~6 lines)
Test plan
posthog-android-gradle-plugin/+ changeset declaringposthog-android) produces the expected mismatch comment. Shared workflow run: https://github.com/PostHog/posthog-android/actions/runs/25330885192@posthog/...names). Shared workflow run: https://github.com/PostHog/posthog-js/actions/runs/25331157848uses:from a feature branch works (no org-level restriction blocking it).script-refinput correctly fetches the script from the same ref as the caller pinned to.Out of scope
Major-version-bump policies (e.g., posthog-js's autoload constraint blocking
posthog-js: major) stay in each repo's existing workflow. This shared workflow handles coverage only.After merge
Caller PRs in posthog-android and posthog-js will update their
uses:from@feat/changeset-hygieneto@mainand drop thescript-refinput.