Skip to content

Commit 6a668be

Browse files
Merge branch 'main' into feature/#1683--fixed-mono-repo-use-short-hand-git-tag
2 parents 260fad2 + 96ca062 commit 6a668be

73 files changed

Lines changed: 2284 additions & 398 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changesets
22

3-
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works with mono-repos or single package repos to help you version and release your code. You can find the full documentation for it [in our repository](https://github.com/changesets/changesets)
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works with mono-repos or single package repos to help you version and release your code. You can find the full documentation for it [in our repository](https://github.com/changesets/changesets).
44

5-
We have a quick list of common questions to get you started engaging with this project in [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
5+
We have a quick list of common questions to get you started engaging with this project in [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md).

.changeset/flat-zoos-share.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/cli": minor
3+
---
4+
5+
Error on unsupported flags for individual CLI commands and print the matching command usage to make mistakes easier to spot.

.changeset/help-on-all-commands.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/cli": minor
3+
---
4+
5+
Respond to `--help` on all subcommands. Previously, `--help` was only handled when it was the sole argument; passing it alongside a subcommand (e.g. `changeset version --help`) would silently execute the command instead. Now `--help` always exits early and prints per-command usage when a known subcommand is provided, or the general help text otherwise.

.changeset/warm-kings-hammer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/cli": patch
3+
---
4+
5+
Improved detection for `published` state of prerelease-only packages without `latest` dist-tag on GitHub Packages registry.

.github/actions/ci-setup/action.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
name: Setup CI
22

3+
inputs:
4+
node-version:
5+
description: "Node.js version"
6+
required: false
7+
default: 20
8+
39
runs:
410
using: composite
511
steps:
6-
- name: Setup Node.js 20.x
7-
uses: actions/setup-node@v4
12+
- name: Setup Node.js ${{ inputs.node-version }}
13+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
814
with:
9-
node-version: 20.x
15+
node-version: ${{ inputs.node-version }}
1016
cache: yarn
1117

1218
- name: Install dependencies

.github/workflows/changeset-version.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
pull_request:
55
push:
66
branches: [main]
7+
merge_group:
8+
branches: [main]
79

810
permissions:
911
contents: read

.github/workflows/publish.yml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- next
8+
issue_comment:
9+
types: [created]
10+
11+
concurrency: ${{ github.workflow }}-${{ github.event_name == 'issue_comment' && github.event.issue.number || github.ref }}
12+
13+
permissions: {} # each job should define its own permission explicitly
14+
15+
jobs:
16+
publish:
17+
name: Publish
18+
if: github.repository == 'changesets/changesets' && github.event_name == 'push'
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 20
21+
permissions:
22+
contents: write # to create release (changesets/action)
23+
issues: write # to post issue comments (changesets/action)
24+
pull-requests: write # to create pull request (changesets/action)
25+
id-token: write # to use OpenID Connect token for trusted publishing (changesets/action)
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: ./.github/actions/ci-setup
29+
with:
30+
node-version: 24
31+
32+
- name: Create Release Pull Request or Publish to npm
33+
# https://github.com/changesets/action
34+
uses: changesets/action@v1
35+
with:
36+
# this expects you to have a script called release which does a build for your packages and calls changeset publish
37+
publish: yarn release
38+
version: yarn version-packages
39+
40+
publish_pr:
41+
if: github.repository == 'changesets/changesets' && github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/publish-pr')
42+
timeout-minutes: 20
43+
runs-on: ubuntu-latest
44+
permissions:
45+
contents: read # to checkout the pull request
46+
id-token: write # to use OpenID Connect token for trusted publishing
47+
issues: write # to post comments and reactions
48+
pull-requests: write # to post reactions on PR comments
49+
steps:
50+
- name: Report in-progress reaction
51+
id: report_in_progress
52+
run: |
53+
REACTION_ID=$(gh api /repos/${{github.repository}}/issues/comments/${{github.event.comment.id}}/reactions -f content='eyes' --jq '.id')
54+
echo "in_progress_reaction_id=$REACTION_ID" >> "$GITHUB_OUTPUT"
55+
env:
56+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Check if user is authorized to publish
59+
id: check_authorization
60+
run: |
61+
if [[ $AUTHOR_ASSOCIATION == 'MEMBER' || $AUTHOR_ASSOCIATION == 'OWNER' || $AUTHOR_ASSOCIATION == 'COLLABORATOR' ]]
62+
then
63+
echo "User is authorized to publish"
64+
else
65+
echo "User is not authorized to publish"
66+
exit 1
67+
fi
68+
env:
69+
AUTHOR_ASSOCIATION: ${{ github.event.comment.author_association }}
70+
71+
- uses: actions/checkout@v4
72+
73+
- name: Checkout pull request
74+
run: gh pr checkout ${{ github.event.issue.number }}
75+
env:
76+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
78+
- name: Check if Version Packages PR
79+
id: check_version_packages
80+
run: |
81+
IS_VERSION_PACKAGES_PR=$(gh pr view ${{ github.event.issue.number }} --json headRefName --jq '.headRefName|startswith("changeset-release/")')
82+
echo "is_version_packages_pr=$IS_VERSION_PACKAGES_PR" >> "$GITHUB_OUTPUT"
83+
env:
84+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
86+
# for Version Packages PR we want to publish the state from before the Version Packages commit
87+
- name: Reset Version Packages PR
88+
if: steps.check_version_packages.outputs.is_version_packages_pr == 'true'
89+
run: git reset --hard HEAD~1
90+
91+
- uses: ./.github/actions/ci-setup
92+
with:
93+
node-version: 24
94+
95+
- name: Compute snapshot version
96+
id: snapshot_version
97+
run: |
98+
PUBLISH_TAG="pr${{ github.event.issue.number }}"
99+
SNAPSHOT_TAG="${PUBLISH_TAG}.$(git rev-parse --short HEAD)"
100+
101+
echo "publish_tag=$PUBLISH_TAG" >> "$GITHUB_OUTPUT"
102+
echo "snapshot_tag=$SNAPSHOT_TAG" >> "$GITHUB_OUTPUT"
103+
echo "version=0.0.0-$SNAPSHOT_TAG" >> "$GITHUB_OUTPUT"
104+
105+
- run: yarn changeset version --snapshot "${{ steps.snapshot_version.outputs.snapshot_tag }}" --snapshot-prerelease-template "{tag}"
106+
env:
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
109+
- run: yarn build
110+
111+
- name: Publish snapshot versions
112+
run: yarn changeset publish --tag "${{ steps.snapshot_version.outputs.publish_tag }}"
113+
114+
- name: Post comment with published version
115+
run: |
116+
cat <<'BODY' > /tmp/comment-body.md
117+
Published snapshot version `${{ steps.snapshot_version.outputs.version }}` in response to [this comment](${{ github.event.comment.html_url }}).
118+
BODY
119+
gh issue comment "${{ github.event.issue.number }}" --body-file /tmp/comment-body.md
120+
env:
121+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
123+
- name: Post failure comment
124+
if: failure()
125+
run: |
126+
FAILED_JOB_ID=$(gh api "/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" --jq ".jobs[] | select(.name == \"$GITHUB_JOB\") | .id")
127+
LINK="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${FAILED_JOB_ID}"
128+
129+
cat <<BODY > /tmp/comment-body.md
130+
Snapshot publish triggered by [this comment](${{ github.event.comment.html_url }}) failed. [See the failed job](${LINK}).
131+
BODY
132+
gh issue comment "${{ github.event.issue.number }}" --body-file /tmp/comment-body.md
133+
env:
134+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135+
136+
- name: Add result reaction
137+
if: always() && steps.report_in_progress.outcome == 'success'
138+
run: |
139+
gh api /repos/${{github.repository}}/issues/comments/${{github.event.comment.id}}/reactions \
140+
-f content="${{ job.status == 'success' && 'rocket' || '-1' }}"
141+
env:
142+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143+
144+
- name: Remove in-progress reaction
145+
if: always() && steps.report_in_progress.outcome == 'success'
146+
run: gh api -X DELETE /repos/${{github.repository}}/issues/comments/${{github.event.comment.id}}/reactions/${{steps.report_in_progress.outputs.in_progress_reaction_id}}
147+
env:
148+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ To make releasing easier, you can use [this changesets github action](https://gi
7575
- [verdaccio](https://verdaccio.org)
7676
- [Chakra UI](https://chakra-ui.com)
7777
- [Astro](https://astro.build)
78+
- [Biome](https://biomejs.dev)
7879
- [SvelteKit](https://kit.svelte.dev)
7980
- [Hydrogen](https://hydrogen.shopify.dev)
8081
- [react-pdf](https://github.com/diegomura/react-pdf)
@@ -96,6 +97,7 @@ To make releasing easier, you can use [this changesets github action](https://gi
9697
- [Apollo Client](https://github.com/apollographql/apollo-client)
9798
- [Adobe Spectrum CSS](https://github.com/adobe/spectrum-css)
9899
- [Adobe Spectrum Web Components](https://github.com/adobe/spectrum-web-components)
100+
- [React Email](https://react.email)
99101

100102
<!-- NOTE: we currently only accept new entries with at least 1000 GitHub stars -->
101103

docs/command-line-options.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The command line for changesets is the main way of interacting with it. There are 4 main commands. If you are looking for how we recommend you setup and manage changesets with the commands, check out our [intro to using changesets](./intro-to-using-changesets.md)
44

55
- init
6-
- add [--empty][--open]
6+
- add [--empty] [--open] [--since <ref>] [--message <text>]
77
- version [--ignore, --snapshot]
88
- publish [--otp=code, --tag]
99
- status [--since=master --verbose --output=JSON_FILE.json]
@@ -65,6 +65,13 @@ A changeset created with the empty flag would look like this:
6565
If you set the commit option in the config, the command will add the updated changeset files and then commit them.
6666

6767
- `--open` - opens the created changeset in an external editor
68+
- `--message` (or `-m`) - provides the changeset summary from the command line instead of prompting for it.
69+
70+
- `--since` - uses the provided branch, tag, or git ref (such as `main` or a git commit hash) to detect which packages have changed when populating the list of changed packages in the CLI. This is useful in gitflow workflows where you have multiple target branches and `baseBranch` in the config doesn't cover all use cases. If not provided, the command falls back to the `baseBranch` value in your `.changeset/config.json`.
71+
72+
```
73+
changeset add --since=develop
74+
```
6875

6976
## version
7077

0 commit comments

Comments
 (0)