Skip to content

Conversation

@lukasoppermann
Copy link
Contributor

@lukasoppermann lukasoppermann commented Nov 11, 2025

Closes https://github.com/github/primer/issues/5270

Changelog

Updated storybook story to make sure we can test all instances of BranchName

New

Changed

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

@lukasoppermann lukasoppermann requested a review from a team as a code owner November 11, 2025 08:46
@changeset-bot
Copy link

changeset-bot bot commented Nov 11, 2025

⚠️ No Changeset found

Latest commit: 93a040c

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

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Nov 11, 2025
@github-actions
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

Copilot finished reviewing on behalf of lukasoppermann November 11, 2025 08:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces stricter TypeScript typing for the BranchName component to ensure type safety around the href attribute. The component now enforces that href is required when rendering as an anchor tag (either explicitly with as="a" or by default), and disallows href when rendering as other elements.

Key changes:

  • Added conditional type constraint requiring href: string when As extends 'a' and href?: never otherwise
  • Updated default generic parameter to 'a' for better type inference
  • Added test coverage for the new type constraints using @ts-expect-error annotations

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/react/src/BranchName/BranchName.tsx Added conditional type to enforce href requirement based on as prop value and set default generic parameter to 'a'
packages/react/src/BranchName/tests/BranchName.test.tsx Updated existing tests to comply with new type constraints and added three new tests to verify type enforcement
.changeset/plenty-cloths-dance.md Added changeset documenting the breaking type change as a patch release

Copy link
Member

Choose a reason for hiding this comment

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

Don't need a changset if you are only updating stories. Just add skip changeset label to your PR :)

Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

only one change needed

@lukasoppermann lukasoppermann changed the title BranchName: Stricter type BranchName: Update storybook Nov 12, 2025
@lukasoppermann lukasoppermann added the skip changeset This change does not need a changelog label Nov 12, 2025
@lukasoppermann lukasoppermann added this pull request to the merge queue Nov 12, 2025
Merged via the queue into main with commit 17c6318 Nov 12, 2025
54 of 55 checks passed
@lukasoppermann lukasoppermann deleted the BranchName branch November 12, 2025 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants