Skip to content

ci: credit original authors of mirrored external PRs in changelogs - #3496

Merged
shrey150 merged 4 commits into
mainfrom
ci/changelog-credit-mirrored-prs
Nov 20, 2026
Merged

shrey150 merged 4 commits into
mainfrom
ci/changelog-credit-mirrored-prs

Conversation

@shrey150

@shrey150 shrey150 commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Changesets merged through a mirrored external contributor PR currently show Thanks @github-actions! in release notes, because the mirror PR is authored by the bot.

This wraps @changesets/changelog-github in .changeset/changelog.cjs. For each changeset, if its commit came from a merged PR authored by github-actions[bot] that carries the external-contributor-pr:owned source-pr= marker, it adds pr:, commit: and author: overrides pointing at the original PR and its author (read from the GitHub API, not from the PR body text). Changesets that already have overrides, and every non-mirrored PR, are left unchanged.

Checked locally against the three pending mirrored changesets (#3463, #3422, #3465 now credit their authors) and a regular PR (#3450 is unchanged).

If a GitHub lookup fails, the wrapper logs a warning and falls back to the default credit, so it can't block a release PR.

Dry run (Nov 19) against the live repo with @changesets/changelog-github 0.7.0: empty-response-header-values now credits #3422 / @aryansahai22, host-only-cookie-matching credits #3465 / @Kelvin-Waititu, a regular changeset (eve-1-0-upgrade, #3409) is unchanged, and a simulated API failure falls back to the default line.

No tests added: the failure mode is attribution in release notes, not publishing, and the release PR diff shows the output before anything ships.


Summary by cubic

Fixes release notes so changesets merged through mirrored external contributor PRs credit the original author instead of github-actions[bot].

  • Wraps @changesets/changelog-github in .changeset/changelog.cjs to detect mirrored PRs via the external-contributor-pr:owned marker and add pr:, commit:, and author: overrides from the GitHub API.
  • Takes the last marker occurrence, since the mirror body quotes the original PR description before the trusted marker.
  • Leaves changesets that already have overrides and non-mirrored PRs unchanged, and falls back to the default credit when the GitHub lookup fails so a release can't be blocked.

Written for commit 72b02d0. Summary will update on new commits.

View guided diff Turn on auto-fix

@changeset-bot

changeset-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 72b02d0

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

@shrey150
shrey150 marked this pull request as ready for review November 19, 2026 22:38

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 2 files

Architecture diagram
sequenceDiagram
    participant Changesets as Changesets CLI
    participant Wrapper as .changeset/changelog.cjs
    participant Base as @changesets/changelog-github
    participant GHAPI as GitHub API

    Note over Changesets,GHAPI: Release changelog generation flow

    Changesets->>Wrapper: getReleaseLine(changeset, type, options)
    
    alt Changeset has existing overrides or no commit
        Wrapper-->>Changesets: Passthrough (unchanged)
    else Mirrored PR detected
        Wrapper->>GHAPI: GET /repos/{repo}/commits/{commit}/pulls
        GHAPI-->>Wrapper: PR list
        
        alt PR authored by github-actions[bot] with marker
            Wrapper->>GHAPI: GET /repos/{repo}/pulls/{source}
            GHAPI-->>Wrapper: Original PR details
            Wrapper->>Wrapper: Build overrides (pr, commit, author)
            Wrapper->>Base: getReleaseLine(creditedChangeset)
            Base-->>Wrapper: Release line
            Wrapper-->>Changesets: Release line with original author
        else Non-mirrored PR
            Wrapper->>Base: getReleaseLine(original changeset)
            Base-->>Wrapper: Release line
            Wrapper-->>Changesets: Release line (unchanged)
        end
    end

    Note over Wrapper,GHAPI: Error handling path
    
    Wrapper->>GHAPI: GitHub API call
    alt API failure or missing data
        GHAPI-->>Wrapper: Error / empty response
        Wrapper->>Wrapper: Log warning
        Wrapper->>Base: getReleaseLine(original changeset)
        Base-->>Wrapper: Release line
        Wrapper-->>Changesets: Release line (default credit)
    end
Loading

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread .changeset/changelog.cjs Resolved
@shrey150
shrey150 merged commit b529d4b into main Nov 20, 2026
26 checks passed
@shrey150
shrey150 deleted the ci/changelog-credit-mirrored-prs branch November 20, 2026 18:15
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