Skip to content

Commit 3a72bc5

Browse files
committed
Merge remote-tracking branch 'upstream/main' into chore/merge-changes
* upstream/main: (28 commits) Version Packages (changesets#480) Fixed missed `__dirname` reference (changesets#496) Switch to bundling with Rollup (changesets#495) Migrate to ESM (changesets#484) Fixed situations in which `cwd` was specified as a relative path and used with (default) `commitMode: git-cli` (changesets#486) Add LICENSE file (changesets#491) Fix PRs sometimes not getting reopened with `commitMode: github-api` (changesets#488) Removed `fs-extra` dependency (changesets#481) Setup Git user in `release-pr` workflow (changesets#493) Use proper ndoe version in `release-pr` workflow (changesets#492) Add `release-pr` workflow (changesets#490) Migrate to Vitest (changesets#483) Switch to `esbuild` for bundling (changesets#479) Import only for `semver/functions/lt` (changesets#482) Avoid hitting a deprecation warning when encountering errors from `@octokit/request-error` (changesets#461) Run typecheck on CI (changesets#478) Updated `@actions/*` and `@octokit/*` dependencies (changesets#477) Bump @babel/runtime from 7.21.5 to 7.27.1 (changesets#464) Version Packages (changesets#476) Make git add work consistently with subdirectories (changesets#473) ...
2 parents a68b570 + 04d574e commit 3a72bc5

31 files changed

+8780
-398
lines changed

.babelrc

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Setup CI
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Setup Node.js
7+
uses: actions/setup-node@v4
8+
with:
9+
node-version-file: ".node-version"
10+
cache: yarn
11+
12+
- name: Install dependencies
13+
shell: bash
14+
run: yarn install --frozen-lockfile

.github/workflows/ci.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Node CI
22

3-
on: [pull_request]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
48

59
jobs:
610
build:
@@ -9,16 +13,14 @@ jobs:
913
runs-on: ubuntu-latest
1014

1115
steps:
12-
- name: Checkout Repo
13-
uses: actions/checkout@v4
14-
15-
- name: Use Node.js 20
16-
uses: actions/setup-node@v4
16+
- uses: actions/checkout@v4
1717
with:
18-
node-version: 20.x
18+
ref: ${{ github.event.pull_request.head.sha }}
19+
20+
- uses: ./.github/actions/ci-setup
1921

20-
- name: Install Dependencies
21-
run: yarn --frozen-lockfile
22+
- name: Typecheck
23+
run: yarn typecheck
2224

2325
- name: Test
2426
run: yarn test

.github/workflows/release-pr.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Release PR
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
jobs:
8+
release_check:
9+
if: github.repository == 'changesets/action' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/release-pr')
10+
runs-on: ubuntu-latest
11+
steps:
12+
- id: report_in_progress
13+
run: |
14+
echo "in_progress_reaction_id=$(gh api /repos/${{github.repository}}/issues/comments/${{github.event.comment.id}}/reactions -f content='eyes' --jq '.id')" >> "$GITHUB_OUTPUT"
15+
env:
16+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
18+
- id: check_authorization
19+
run: |
20+
if [[ $AUTHOR_ASSOCIATION == 'MEMBER' || $AUTHOR_ASSOCIATION == 'OWNER' || $AUTHOR_ASSOCIATION == 'COLLABORATOR' ]]
21+
then
22+
echo "User is authorized to release"
23+
else
24+
echo "User is not authorized to release"
25+
exit 1
26+
fi
27+
env:
28+
AUTHOR_ASSOCIATION: ${{ github.event.comment.author_association }}
29+
30+
outputs:
31+
in_progress_reaction_id: ${{ steps.report_in_progress.outputs.in_progress_reaction_id }}
32+
33+
release:
34+
if: github.repository == 'changesets/action'
35+
timeout-minutes: 20
36+
runs-on: ubuntu-latest
37+
needs: release_check
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: ./.github/actions/ci-setup
41+
42+
- name: Checkout pull request
43+
run: gh pr checkout ${{ github.event.issue.number }}
44+
env:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Check if Version Packages PR
48+
id: check_version_packages
49+
run: |
50+
echo "version_packages=$(gh pr view ${{ github.event.issue.number }} --json headRefName --jq '.headRefName|startswith("changeset-release/")')" >> "$GITHUB_OUTPUT"
51+
env:
52+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Reset Version Packages PR
55+
if: steps.check_version_packages.outputs.version_packages == 'true'
56+
run: git reset --hard HEAD~1
57+
58+
- run: yarn changeset version --snapshot pr${{ github.event.issue.number }}
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- name: Build
63+
run: yarn build
64+
65+
- name: Setup Git user
66+
run: |
67+
git config --global user.name "github-actions[bot]"
68+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
69+
70+
- name: Release snapshot version
71+
run: yarn run release:pr
72+
73+
- run: gh api /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions -f content='rocket'
74+
env:
75+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
77+
- run: gh api -X DELETE /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions/${{ needs.release_check.outputs.in_progress_reaction_id }}
78+
env:
79+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
81+
- run: gh pr comment ${{ github.event.issue.number }} --body "The [${{ github.repository }}@$(git rev-parse HEAD)](https://github.com/${{ github.repository }}/commit/$(git rev-parse HEAD)) release triggered by [this comment](${{ github.event.comment.url }}) has [succeeded](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})."
82+
env:
83+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
85+
report-failure-if-needed:
86+
needs: [release_check, release]
87+
timeout-minutes: 2
88+
runs-on: ubuntu-latest
89+
if: failure() && github.repository == 'changesets/action' && (needs.release_check.result == 'failure' || needs.release.result == 'failure')
90+
steps:
91+
- run: gh api /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions -f content='-1'
92+
env:
93+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94+
95+
- run: gh api -X DELETE /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions/${{ needs.release_check.outputs.in_progress_reaction_id }}
96+
env:
97+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
99+
- run: gh pr comment ${{ github.event.issue.number }} --body "The release triggered by [this comment](${{ github.event.comment.url }}) has [failed](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})."
100+
env:
101+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
GH_REPO: ${{ github.repository }}

.github/workflows/version-or-publish.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,8 @@ jobs:
1111
changesets:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Checkout Repo
15-
uses: actions/checkout@v4
16-
17-
- name: Use Node.js 20
18-
uses: actions/setup-node@v4
19-
with:
20-
node-version: 20.x
21-
22-
- name: Install Dependencies
23-
run: yarn --frozen-lockfile
14+
- uses: actions/checkout@v4
15+
- uses: ./.github/actions/ci-setup
2416

2517
- name: Build
2618
run: yarn build

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v22.9.0

.vscode/launch.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
3+
"version": "0.2.0",
4+
"configurations": [
5+
{
6+
"type": "node",
7+
"request": "launch",
8+
"name": "Debug Current Test File",
9+
"autoAttachChildProcesses": true,
10+
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
11+
"args": ["run", "${relativeFile}"],
12+
"smartStep": true,
13+
"console": "integratedTerminal"
14+
}
15+
]
16+
}

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "node_modules/typescript/lib"
3+
}

CHANGELOG.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,54 @@
11
# @changesets/action
22

3+
## 1.5.3
4+
5+
### Patch Changes
6+
7+
- [#477](https://github.com/changesets/action/pull/477) [`9d933dc`](https://github.com/changesets/action/commit/9d933dcd11c284ac49a835db884c3c1008b2b96f) Thanks [@Andarist](https://github.com/Andarist)! - Updated `@actions/*` and `@octokit/*` dependencies.
8+
9+
- [#479](https://github.com/changesets/action/pull/479) [`cf373e4`](https://github.com/changesets/action/commit/cf373e45c90a0cc564cd2770de3e9a3a4cdd4603) Thanks [@Andarist](https://github.com/Andarist)! - Switched to `esbuild` for bundling the dist file. This led to 45% file size reduction.
10+
11+
- [#488](https://github.com/changesets/action/pull/488) [`022692b`](https://github.com/changesets/action/commit/022692ba027b33bf46d4d41907a317fbf04461a7) Thanks [@s0](https://github.com/s0)! - Fix PRs sometimes not getting reopened with `commitMode: github-api`
12+
13+
There was a race-condition that means sometimes existing PRs would not be found,
14+
and new PRs would be opened. This has now been fixed by fetching existing PRs
15+
before making any changes.
16+
17+
- [#486](https://github.com/changesets/action/pull/486) [`7ed1955`](https://github.com/changesets/action/commit/7ed195554624ebd75c08aa477b53110f61cc78f7) Thanks [@s0](https://github.com/s0)! - Fixed situations in which `cwd` was specified as a relative path and used with (default) `commitMode: git-cli`
18+
19+
- [#461](https://github.com/changesets/action/pull/461) [`e9c36b6`](https://github.com/changesets/action/commit/e9c36b696406360bf04204ad32e3dcf3ad752b77) Thanks [@nayounsang](https://github.com/nayounsang)! - Avoid hitting a deprecation warning when encountering errors from `@octokit/request-error`
20+
21+
## 1.5.2
22+
23+
### Patch Changes
24+
25+
- [#473](https://github.com/changesets/action/pull/473) [`3c24abe`](https://github.com/changesets/action/commit/3c24abeab26da6335c181222faa2ea485a092cf8) Thanks [@s0](https://github.com/s0)! - Make git add work consistently with subdirectories
26+
27+
Ensure that when running the action from a subdirectory of a repository,
28+
only the files from that directory are added, regardless of `commitMode`.
29+
30+
## 1.5.1
31+
32+
### Patch Changes
33+
34+
- [#471](https://github.com/changesets/action/pull/471) [`15ab130`](https://github.com/changesets/action/commit/15ab1306067a396fa9ba7ad363e8a041d457782a) Thanks [@h3rmanj](https://github.com/h3rmanj)! - Bump `@changesets/ghcommit` to v1.4.0, which fixes an issue running this action in monorepos with `commitMode: github-api`
35+
36+
- [#467](https://github.com/changesets/action/pull/467) [`6e57550`](https://github.com/changesets/action/commit/6e575506e63f9e69e475d3eccfdd61b448efc8ae) Thanks [@Vx-V](https://github.com/Vx-V)! - Avoid searching for an existing pull request early.
37+
38+
## 1.5.0
39+
40+
### Minor Changes
41+
42+
- [#391](https://github.com/changesets/action/pull/391) [`207dc3d`](https://github.com/changesets/action/commit/207dc3da2d1907cae0454ce123935401332be72b) Thanks [@s0](https://github.com/s0)! - Introduce a new input `commitMode` that allows using the GitHub API for pushing tags and commits instead of the Git CLI.
43+
44+
When used with `"github-api"` value all tags and commits will be attributed to the user whose GITHUB_TOKEN is used, and also signed using GitHub's internal GPG key.
45+
46+
## 1.4.10
47+
48+
### Patch Changes
49+
50+
- [#448](https://github.com/changesets/action/pull/448) [`8b16070`](https://github.com/changesets/action/commit/8b16070fe386eed3456c83eeed9460160432cf26) Thanks [@bluwy](https://github.com/bluwy)! - Use full git email (`41898282+github-actions[bot]@users.noreply.github.com`) for github-actions bot when making commits
51+
352
## 1.4.9
453

554
### Patch Changes

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Changesets team and other contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)