Skip to content

feat(changelog-preview): Preview several packages in one comment - #924

Closed
sentry-junior[bot] wants to merge 8 commits into
masterfrom
feat/changelog-preview-id
Closed

sentry-junior[bot] wants to merge 8 commits into
masterfrom
feat/changelog-preview-id

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Lets one changelog preview cover several packages: list their directories in working-directory, one per line. The PR gets a single comment (or one status and job summary) with a collapsed section per package that the PR changes.

Use case: one PR that touches two packages

Some repos release several packages from separate Craft configs. For example, getsentry/objectstore has a Python client and a Rust client, each with its own .craft.yml. Today the only option is to call the preview workflow once per package, and then a PR that changes both clients breaks:

  • Comment mode: both runs look up the same craft-changelog-preview comment, so the second overwrites the first. Only one preview survives, and nothing says which package it's for.
  • Status mode: both post the Changelog Preview / Semver Impact context, so the last one wins.

The earlier version of this PR gave each directory its own comment and status. As review pointed out, that's noisy. It also needed hashing to keep statuses apart under GitHub's case-insensitive contexts. Rendering every package in one job avoids both problems, and there's no race between jobs editing a shared comment.

The change

jobs:
  changelog-preview:
    uses: getsentry/craft/.github/workflows/changelog-preview.yml@v3
    with:
      working-directory: |
        clients/python
        clients/rust

The preview becomes:

<!-- craft-changelog-preview -->
## Changelog Preview

This is how your changes will appear in each package's changelog.
Entries from this PR are highlighted with a left border (blockquote style).

<details>
<summary><code>clients/python</code> · 🟡 Minor (new features)</summary>

…changelog…

</details>

<details>
<summary><code>clients/rust</code> · 🟢 Patch (bug fixes)</summary>

…changelog…

</details>
  • Only changed packages: craft changelog --pr adds the PR to every changelog it renders, so the step only renders the packages this PR changes, using git diff --quiet <base>...HEAD -- <dir>. If it changes none of them, the preview says so.
  • Status mode: one status, still Changelog Preview / Semver Impact. Its description lists each package, e.g. clients/python: Minor, clients/rust: Patch (cut to GitHub's 140-character limit). The job summary has the same sections as the comment.
  • Title enforcement: bump_type, pr_skipped and versioning_policy come from the package with the biggest bump. When no package is changed, pr_skipped is true, so require-conventional-title doesn't fail PRs outside the packages.
  • Single directory (the default): nothing changes. I ran master's step and this one side by side for . and a sub-directory in both modes. The comment body, job summary, status arguments and step outputs were byte-for-byte identical. The step now runs from the repo root and cds into the directory for craft, instead of setting the step's working-directory.
  • Labels: directory names in the summaries are HTML-escaped.
  • Docs: the working-directory input row and a short "Multiple Packages" section in docs/src/content/docs/github-actions.md.

Testing

src/__tests__/changelog-preview-workflow.test.ts runs the real "Generate Changelog Preview" step from the workflow file in a temp git repo with a base commit and a PR commit. It uses a stubbed craft and a fake gh that stores comments and records statuses. Lookups go through the step's own --jq filter. It covers:

  • '', . and packages/python keep the single-package layout and update one comment in place;
  • two changed packages render as two collapsed sections, with their own bumps, in one comment that's updated in place. The list is normalised, so ./packages/rust/ works, and bump_type is the biggest;
  • packages the PR doesn't change are left out;
  • a PR that changes none of them gets a note and pr_skipped=true;
  • status mode posts one status listing each package, with both sections in the job summary.

actionlint, prettier, eslint and tsc are clean. I haven't run it on a real PR.

Details

via Junior system actor event.

--

View Junior Session [Sentry]

…ws apart

Co-Authored-By: Lorenzo Cian <17258265+lcian@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-28 09:45 UTC

@lcian
lcian marked this pull request as draft October 23, 2026 12:56
Co-Authored-By: Lorenzo Cian <17258265+lcian@users.noreply.github.com>
@sentry-junior sentry-junior Bot changed the title feat(changelog-preview): Add preview-id input to keep multiple previews apart feat(changelog-preview): Keep previews for different directories apart Oct 23, 2026

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, sounds great and thanks for the PR! I wonder if we can share a single PR with multiple change logs, collapsed by default? Looks possible with your markers which we can even move into the <details> elements or something or workspace headers?

@MathurAditya724 MathurAditya724 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This adds useful monorepo preview isolation that is separate from the AI-summary work merged in #929. Two follow-ups below: avoid directory-identity collisions and preserve the behavior in automated regression tests.

Comment thread .github/workflows/changelog-preview.yml Resolved
Comment thread .github/workflows/changelog-preview.yml Resolved

@MathurAditya724 MathurAditya724 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both earlier comments are addressed: normalization plus a hash separates sanitized paths, and committed fixture tests execute the actual preview step. The seven committed tests pass locally, with typechecking, ESLint and formatting also passing. Additional isolated probes passed for equivalent directory spellings, unsafe/Unicode names and CalVer behavior. One remaining status-mode collision is documented inline: GitHub compares status contexts case-insensitively, unlike comment markers. No other actionable correctness or DRY issues found in the three-file diff.

Comment thread .github/workflows/changelog-preview.yml Resolved
@BYK
BYK marked this pull request as ready for review October 26, 2026 18:19
Comment thread docs/src/content/docs/github-actions.md Resolved
@sentry-junior sentry-junior Bot changed the title feat(changelog-preview): Keep previews for different directories apart feat(changelog-preview): Preview several packages in one comment Oct 26, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a3aa50c. Configure here.

Comment thread .github/workflows/changelog-preview.yml Resolved
…f previewing nothing

Running Craft through `cd` inside the fallback-guarded command swallowed a
missing directory, so a mistyped single directory produced a green 'None'
preview (master fails the step), and a mistyped entry in a multi-directory
list was silently dropped. Check every directory up front.

Co-Authored-By: Lorenzo Cian <17258265+lcian@users.noreply.github.com>
inputs:
working-directory:
description: 'Directory to run Craft in (relative to repo root)'
description: 'Directory to run Craft in (relative to repo root). List one directory per line to preview several packages in one comment.'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This shouldn't be necessary when using workspaces: https://craft.sentry.dev/targets/github/#release-workspaces

And we should force people to use that rather than having multiple working directories with their own .craft.yml files

@lcian

lcian commented Oct 28, 2026

Copy link
Copy Markdown
Member

We're going to use workspaces which is the proper way to release multiple packages.
This is still gonna be a problem, flagged as one of the requirements in #941

@lcian lcian closed this Oct 28, 2026

This branch was previously deployed

1 inactive deployment
false — d4ea5591 Deployed Oct 27, 2026 by sentry-junior[bot] via Build #3217
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.

3 participants