Skip to content

Conversation

@KyleAMathews
Copy link
Contributor

@KyleAMathews KyleAMathews commented Oct 12, 2025

Summary

  • Adds automation to comment on PRs when they're included in a release
  • Creates a reusable composite action that any TanStack repo can adopt
  • Parses CHANGELOGs to find PR numbers and posts comments with release info and CHANGELOG links

How It Works

  1. When the changesets/action publishes packages, it outputs the list of published packages with their versions
  2. The composite action runs a TypeScript script that:
    • Parses each published package's CHANGELOG to find PR numbers in the latest version entry
    • Groups PRs by number (handling cases where one PR affects multiple packages)
    • Posts a comment on each PR using gh CLI with release info and CHANGELOG links

Example Comment

🎉 This PR has been released!

- **@tanstack/config@0.21.0** - [CHANGELOG](https://github.com/TanStack/config/blob/main/packages/config/CHANGELOG.md)

Thank you for your contribution!

Files Added

  • .github/comment-on-release/action.yml - Reusable composite action
  • .github/comment-on-release/comment-on-release.ts - Script that parses CHANGELOGs and comments on PRs
  • .github/comment-on-release/README.md - Documentation for adopting this action

Files Modified

  • .github/workflows/release.yml - Updated to use the new composite action

Usage in Other TanStack Repos

To enable PR commenting on releases in other TanStack repos, add this step to .github/workflows/release.yml after the changesets action:

- name: Run Changesets (version or publish)
  id: changesets
  uses: changesets/action@v1.5.3
  with:
    version: pnpm run changeset:version
    publish: pnpm run changeset:publish
    commit: "ci: Version Packages"
    title: "ci: Version Packages"
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Comment on PRs about release
  if: steps.changesets.outputs.published == 'true'
  uses: tanstack/config/.github/comment-on-release@main
  with:
    published-packages: ${{ steps.changesets.outputs.publishedPackages }}

Requirements

  • Must be using Changesets for releases
  • CHANGELOGs must include PR links in format: [#123](https://github.com/org/repo/pull/123)
  • Workflow must have pull-requests: write permission
  • Packages should be located at packages/{package-name}/CHANGELOG.md

Test Plan

  • Create reusable composite action structure
  • Update TanStack Config's release workflow to use the action
  • Merge this PR
  • Wait for next TanStack Config release to verify comments are posted correctly
  • Adopt in other TanStack repos (Query, Router, Table, etc.)

🤖 Generated with Claude Code

This adds automation to comment on PRs when they are included in a release. The workflow parses CHANGELOGs to extract PR numbers and posts a comment with version info and links to the relevant CHANGELOG files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Oct 12, 2025

⚠️ No Changeset found

Latest commit: b085b94

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@nx-cloud
Copy link

nx-cloud bot commented Oct 12, 2025

View your CI Pipeline Execution ↗ for commit b085b94

Command Status Duration Result
nx run-many --target=build ✅ Succeeded <1s View ↗
nx affected --targets=test:eslint,test:types,te... ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-14 08:24:14 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 12, 2025

@tanstack/config

npm i https://pkg.pr.new/@tanstack/config@304

@tanstack/eslint-config

npm i https://pkg.pr.new/@tanstack/eslint-config@304

@tanstack/publish-config

npm i https://pkg.pr.new/@tanstack/publish-config@304

@tanstack/typedoc-config

npm i https://pkg.pr.new/@tanstack/typedoc-config@304

@tanstack/vite-config

npm i https://pkg.pr.new/@tanstack/vite-config@304

commit: b085b94

KyleAMathews and others added 3 commits October 12, 2025 13:10
Converts the PR commenting feature into a reusable composite action that any TanStack repo can use.

Changes:
- Move script to .github/comment-on-release/ directory
- Create composite action at .github/comment-on-release/action.yml
- Update release workflow to use the composite action
- Other TanStack repos can now use: tanstack/config/.github/comment-on-release@main

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Explains how other TanStack repos can adopt this reusable action.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@lachlancollins lachlancollins self-requested a review October 13, 2025 21:19
@lachlancollins lachlancollins self-assigned this Oct 13, 2025
Copy link
Member

@lachlancollins lachlancollins left a comment

Choose a reason for hiding this comment

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

Amazing stuff! I've slightly tweaked the output to link directly to the version anchor within the changelog. I think it should also run without tsx (Node 24 executes TS, we shall see).

@lachlancollins lachlancollins merged commit 59a3492 into TanStack:main Oct 14, 2025
5 checks passed
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.

2 participants