Skip to content

Add Changesets-based release tracking without forking changesets/action - #54

Closed
TylerJDev with Copilot wants to merge 8 commits into
mainfrom
copilot/implement-changesets-release-flow
Closed

Add Changesets-based release tracking without forking changesets/action#54
TylerJDev with Copilot wants to merge 8 commits into
mainfrom
copilot/implement-changesets-release-flow

Conversation

Copilot AI commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Note

Most of the changed lines are in package-lock.json, due to adding @changesets/changelog-github and @changesets/cli and their dependencies.

Dependabot PRs usually merge without changesets. This means that our usual flow with Changesets does not work. Due to this, we can create our own workflow that will batch all dependency updates in the current release, under one patch bump.

The flow in this PR uses changesets/action@, plus a script that creates automatic patch changesets for unreleased commits when contributions (such as Dependabot) do not have a changeset.

Example: TylerJDev#5

Workflow changes

  • Adds .github/workflows/release.yml, triggered by pushes to main and manually through workflow_dispatch.
  • Runs npm run prepare-release.
  • Uses the standard changesets/action action to open or update a Release tracking pull request or publish the package.
  • Removes the old release publishing workflow.

Copilot AI and others added 2 commits August 21, 2026 19:45
Co-authored-by: TylerJDev <26746305+TylerJDev@users.noreply.github.com>
Co-authored-by: TylerJDev <26746305+TylerJDev@users.noreply.github.com>
Copilot AI changed the title [WIP] Add repository-local Changesets release-tracking flow Add Changesets-based release tracking without forking changesets/action Aug 21, 2026
Copilot AI requested a review from TylerJDev August 21, 2026 19:49

@TylerJDev TylerJDev 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.

Most of the changes are within scripts/prepare-release.mjs, as we try to handle as much as we can through @changesets.

An alternative to this approach is applying a patch changeset to each dependency bump, which would allow us to mainly rely on @changesets.

import {fileURLToPath} from 'node:url'

export const AUTO_CHANGESET_FILENAME = 'auto-release.md'
export const DEFAULT_DEPENDENCY_RELEASE_AGE_DAYS = 30

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.

This is the minimum amount of days before the release PR is generated. If there hasn't been a release in the past 30 days, one will be generated.

Comment thread .changeset/config.json
Comment on lines +1 to +11
{
"$schema": "https://unpkg.com/@changesets/config@4.0.0/schema.json",
"changelog": ["@changesets/changelog-github", {"repo": "github/remote-input-element"}],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}

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.

Mainly copies our config from primer/react (https://github.com/primer/react/blob/main/.changeset/config.json)

@@ -1,27 +0,0 @@
name: Publish

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.

We can rely on the release.yml workflow now instead of manually publishing.

Comment on lines +26 to +37
export function tagExists(tag, cwd) {
try {
git(['rev-parse', '--verify', '--quiet', `refs/tags/${tag}`], cwd)
return true
} catch {
return false
}
}

export function getTagDate(tag, cwd) {
return new Date(Number(git(['log', '-1', '--format=%ct', tag], cwd)) * 1000)
}

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.

Checks the most recent release (e.g. 0.4.0) in order to confirm if that release was made at least 30 days ago.

Comment on lines +126 to +135
export function isSecurityUpdate(pullRequest) {
const text = `${pullRequest.title ?? ''}\n${pullRequest.body ?? ''}`
const labels = (pullRequest.labels ?? []).map(label => (typeof label === 'string' ? label : label.name ?? ''))
return (
labels.some(label => /security|vulnerability/i.test(label)) ||
/<h[1-6]>\s*Security\s*<\/h[1-6]>/i.test(text) ||
/^\s{0,3}#{1,6}\s+Security\b/im.test(text) ||
/\b(?:CVE-\d{4}-\d+|GHSA-[a-z0-9-]+)\b/i.test(text)
)
}

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.

This tries to determine if the contribution is a security update or not - if it is, it'll go ahead and skip the 30 day policy and create a release PR automatically.

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