Skip to content

Commit 32d69a5

Browse files
authored
Merge branch 'main' into add-draft-mode-support
2 parents 63b1daa + f2660aa commit 32d69a5

15 files changed

Lines changed: 3197 additions & 7404 deletions

.changeset/happy-singers-hammer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/action": patch
3+
---
4+
5+
Allow customize PR `branch` field

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
- name: Checkout Repo
1313
uses: actions/checkout@v2
1414

15-
- name: Use Node.js 16
15+
- name: Use Node.js 20
1616
uses: actions/setup-node@v1
1717
with:
18-
node-version: 16.x
18+
node-version: 20.x
1919

2020
- name: Install Dependencies
2121
run: yarn --frozen-lockfile

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
- name: Checkout Repo
1515
uses: actions/checkout@v2
1616

17-
- name: Use Node.js 16
17+
- name: Use Node.js 20
1818
uses: actions/setup-node@v1
1919
with:
20-
node-version: 16.x
20+
node-version: 20.x
2121

2222
- name: Install Dependencies
2323
run: yarn --frozen-lockfile

CHANGELOG.md

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

3+
## 1.4.6
4+
5+
### Patch Changes
6+
7+
- [#350](https://github.com/changesets/action/pull/350) [`9385be9`](https://github.com/changesets/action/commit/9385be9e757839189ea5ee63ec4e3caa8a6ca71b) Thanks [@m-shaka](https://github.com/m-shaka)! - Bump the used node.js from 16 to 20
8+
9+
## 1.4.5
10+
11+
### Patch Changes
12+
13+
- [#282](https://github.com/changesets/action/pull/282) [`eb19e25`](https://github.com/changesets/action/commit/eb19e25e7797cf33dc2de4caa071e85a8057a0f0) Thanks [@mark-omarov](https://github.com/mark-omarov)! - Updated a few dependencies to patch the security vulnerabilities that were reported for their older versions.
14+
15+
## 1.4.4
16+
17+
### Patch Changes
18+
19+
- [#291](https://github.com/changesets/action/pull/291) [`db8a109`](https://github.com/changesets/action/commit/db8a1099bc0ba1dd6f46a5b9df4212e4f69e78c9) Thanks [@varl](https://github.com/varl)! - Wire up [`@octokit/plugin-throttling`](https://github.com/octokit/plugin-throttling.js) with all GitHub Octokit instances
20+
21+
## 1.4.3
22+
23+
### Patch Changes
24+
25+
- [#289](https://github.com/changesets/action/pull/289) [`8b28186`](https://github.com/changesets/action/commit/8b2818674de86a7fc69aebb9ed6b486ee32eb96e) Thanks [@varl](https://github.com/varl)! - Use logging provided by `@actions/core`
26+
27+
## 1.4.2
28+
29+
### Patch Changes
30+
31+
- [#286](https://github.com/changesets/action/pull/286) [`225a1e8`](https://github.com/changesets/action/commit/225a1e8cbcabb7b585174ba0ad806549db40d4cd) Thanks [@varl](https://github.com/varl)! - This patch implements the [`@octokit/plugin-throttling`](https://github.com/octokit/plugin-throttling.js) plugin and [wires
32+
it up with the internal GitHub Octokit instance](https://github.com/actions/toolkit/tree/457303960f03375db6f033e214b9f90d79c3fe5c/packages/github#extending-the-octokit-instance).
33+
34+
This plugin is recommended by [the Octokit docs](://octokit.github.io/rest.js/v19#throttling) as it implements all the GitHub [best practices for integrators](https://docs.github.com/en/rest/guides/best-practices-for-integrators?apiVersion=2022-11-28).
35+
36+
This should help with `changesets/action` gitting spurious secondary rate limits and failing CI jobs, for which the only known workaround is to simply re-run the job.
37+
338
## 1.4.1
439

540
### Patch Changes

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ jobs:
4444
- name: Checkout Repo
4545
uses: actions/checkout@v3
4646

47-
- name: Setup Node.js 16
47+
- name: Setup Node.js 20
4848
uses: actions/setup-node@v3
4949
with:
50-
node-version: 16
50+
node-version: 20
5151

5252
- name: Install Dependencies
5353
run: yarn
@@ -80,10 +80,10 @@ jobs:
8080
- name: Checkout Repo
8181
uses: actions/checkout@v3
8282
83-
- name: Setup Node.js 16.x
83+
- name: Setup Node.js 20.x
8484
uses: actions/setup-node@v3
8585
with:
86-
node-version: 16.x
86+
node-version: 20.x
8787
8888
- name: Install Dependencies
8989
run: yarn
@@ -145,10 +145,10 @@ jobs:
145145
- name: Checkout Repo
146146
uses: actions/checkout@v3
147147
148-
- name: Setup Node.js 16.x
148+
- name: Setup Node.js 20.x
149149
uses: actions/setup-node@v3
150150
with:
151-
node-version: 16.x
151+
node-version: 20.x
152152
153153
- name: Install Dependencies
154154
run: yarn
@@ -189,10 +189,10 @@ jobs:
189189
- name: Checkout Repo
190190
uses: actions/checkout@v3
191191
192-
- name: Setup Node.js 16.x
192+
- name: Setup Node.js 20.x
193193
uses: actions/setup-node@v3
194194
with:
195-
node-version: 16.x
195+
node-version: 20.x
196196
197197
- name: Install Dependencies
198198
run: yarn

action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Changesets
22
description: A GitHub action to automate releases with Changesets
33
runs:
4-
using: "node16"
4+
using: "node20"
55
main: "dist/index.js"
66
inputs:
77
publish:
@@ -28,6 +28,9 @@ inputs:
2828
description: "A boolean value to indicate whether to create Github releases after `publish` or not"
2929
required: false
3030
default: true
31+
branch:
32+
description: Sets the branch in which the action will run. Default to `github.ref_name` if not provided
33+
required: false
3134
outputs:
3235
published:
3336
description: A boolean value to indicate whether a publishing is happened or not

package.json

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,61 @@
11
{
22
"name": "@changesets/action",
3-
"version": "1.4.1",
3+
"version": "1.4.6",
44
"main": "dist/index.js",
55
"license": "MIT",
66
"devDependencies": {
77
"@changesets/changelog-github": "^0.4.2",
88
"@changesets/cli": "^2.20.0",
99
"@changesets/write": "^0.1.6",
10+
"@vercel/ncc": "^0.36.1",
1011
"fixturez": "^1.1.0",
11-
"parcel": "^1.12.3",
1212
"prettier": "^2.0.5",
13-
"typescript": "^3.5.3"
13+
"typescript": "^5.0.4",
14+
"@babel/core": "^7.13.10",
15+
"@babel/preset-env": "^7.13.10",
16+
"@babel/preset-typescript": "^7.13.0",
17+
"@types/fs-extra": "^8.0.0",
18+
"@types/jest": "^29.5.1",
19+
"@types/node": "^20.11.17",
20+
"@types/semver": "^7.5.0",
21+
"babel-jest": "^29.5.0",
22+
"husky": "^3.0.3",
23+
"jest": "^29.5.0"
1424
},
1525
"scripts": {
16-
"build": "parcel build ./src/index.ts --no-source-maps --target=node --bundle-node-modules",
26+
"build": "ncc build src/index.ts -o dist --transpile-only --minify",
1727
"test": "jest",
1828
"test:watch": "yarn test --watch",
1929
"changeset": "changeset",
2030
"bump": "node ./scripts/bump.js",
2131
"release": "node ./scripts/release.js"
2232
},
2333
"engines": {
24-
"node": ">= 16"
34+
"node": ">= 20"
2535
},
2636
"dependencies": {
2737
"@actions/core": "^1.10.0",
2838
"@actions/exec": "^1.1.1",
2939
"@actions/github": "^5.1.1",
30-
"@babel/core": "^7.13.10",
31-
"@babel/preset-env": "^7.13.10",
32-
"@babel/preset-typescript": "^7.13.0",
3340
"@changesets/pre": "^1.0.9",
3441
"@changesets/read": "^0.5.3",
3542
"@manypkg/get-packages": "^1.1.3",
36-
"@types/fs-extra": "^8.0.0",
37-
"@types/jest": "^24.0.18",
38-
"@types/node": "^12.7.1",
39-
"@types/semver": "^6.0.2",
40-
"babel-jest": "^24.9.0",
43+
"@octokit/plugin-throttling": "^5.2.1",
4144
"fs-extra": "^8.1.0",
42-
"husky": "^3.0.3",
43-
"jest": "^24.9.0",
4445
"mdast-util-to-string": "^1.0.6",
4546
"remark-parse": "^7.0.1",
4647
"remark-stringify": "^7.0.3",
4748
"resolve-from": "^5.0.0",
48-
"semver": "^6.3.0",
49+
"semver": "^7.5.3",
4950
"unified": "^8.3.2"
5051
},
5152
"husky": {
5253
"hooks": {}
5354
},
54-
"prettier": {}
55+
"prettier": {},
56+
"resolutions": {
57+
"**/@octokit/core": "4.2.0",
58+
"trim": "^0.0.3",
59+
"y18n": "^4.0.1"
60+
}
5561
}

src/__snapshots__/run.test.ts.snap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`version creates simple PR 1`] = `
4-
Array [
5-
Object {
4+
[
5+
{
66
"base": "some-branch",
77
"body": "This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to some-branch, this PR will be updated.
88
@@ -34,8 +34,8 @@ Array [
3434
`;
3535

3636
exports[`version does not include any release information if a message with simplified release info exceeds size limit 1`] = `
37-
Array [
38-
Object {
37+
[
38+
{
3939
"base": "some-branch",
4040
"body": "This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to some-branch, this PR will be updated.
4141
@@ -52,8 +52,8 @@ Array [
5252
`;
5353

5454
exports[`version does not include changelog entries if full message exceeds size limit 1`] = `
55-
Array [
56-
Object {
55+
[
56+
{
5757
"base": "some-branch",
5858
"body": "This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to some-branch, this PR will be updated.
5959
@@ -74,8 +74,8 @@ Array [
7474
`;
7575

7676
exports[`version doesn't include ignored package that got a dependency update in the PR body 1`] = `
77-
Array [
78-
Object {
77+
[
78+
{
7979
"base": "some-branch",
8080
"body": "This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to some-branch, this PR will be updated.
8181
@@ -96,8 +96,8 @@ Array [
9696
`;
9797

9898
exports[`version only includes bumped packages in the PR body 1`] = `
99-
Array [
100-
Object {
99+
[
100+
{
101101
"base": "some-branch",
102102
"body": "This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to some-branch, this PR will be updated.
103103

src/__snapshots__/utils.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`it sorts the things right 1`] = `
4-
Array [
5-
Object {
4+
[
5+
{
66
"highestLevel": 3,
77
"name": "c",
88
"private": false,
99
},
10-
Object {
10+
{
1111
"highestLevel": 1,
1212
"name": "b",
1313
"private": false,
1414
},
15-
Object {
15+
{
1616
"highestLevel": 3,
1717
"name": "a",
1818
"private": true,

src/index.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
1616

1717
const inputCwd = core.getInput("cwd");
1818
if (inputCwd) {
19-
console.log("changing directory to the one given as the input");
19+
core.info("changing directory to the one given as the input");
2020
process.chdir(inputCwd);
2121
}
2222

2323
let setupGitUser = core.getBooleanInput("setupGitUser");
2424

2525
if (setupGitUser) {
26-
console.log("setting git user");
26+
core.info("setting git user");
2727
await gitUtils.setupUser();
2828
}
2929

30-
console.log("setting GitHub credentials");
30+
core.info("setting GitHub credentials");
3131
await fs.writeFile(
3232
`${process.env.HOME}/.netrc`,
3333
`machine github.com\nlogin github-actions[bot]\npassword ${githubToken}`
@@ -48,27 +48,27 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
4848

4949
switch (true) {
5050
case !hasChangesets && !hasPublishScript:
51-
console.log("No changesets found");
51+
core.info("No changesets found");
5252
return;
5353
case !hasChangesets && hasPublishScript: {
54-
console.log(
54+
core.info(
5555
"No changesets found, attempting to publish any unpublished packages to npm"
5656
);
5757

5858
let userNpmrcPath = `${process.env.HOME}/.npmrc`;
5959
if (fs.existsSync(userNpmrcPath)) {
60-
console.log("Found existing user .npmrc file");
60+
core.info("Found existing user .npmrc file");
6161
const userNpmrcContent = await fs.readFile(userNpmrcPath, "utf8");
6262
const authLine = userNpmrcContent.split("\n").find((line) => {
6363
// check based on https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105
6464
return /^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line);
6565
});
6666
if (authLine) {
67-
console.log(
67+
core.info(
6868
"Found existing auth token for the npm registry in the user .npmrc file"
6969
);
7070
} else {
71-
console.log(
71+
core.info(
7272
"Didn't find existing auth token for the npm registry in the user .npmrc file, creating one"
7373
);
7474
fs.appendFileSync(
@@ -77,7 +77,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
7777
);
7878
}
7979
} else {
80-
console.log("No user .npmrc file found, creating one");
80+
core.info("No user .npmrc file found, creating one");
8181
fs.writeFileSync(
8282
userNpmrcPath,
8383
`//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}\n`
@@ -100,7 +100,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
100100
return;
101101
}
102102
case hasChangesets && !hasNonEmptyChangesets:
103-
console.log("All changesets are empty; not creating PR");
103+
core.info("All changesets are empty; not creating PR");
104104
return;
105105
case hasChangesets:
106106
const { pullRequestNumber } = await runVersion({
@@ -110,13 +110,14 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
110110
commitMessage: getOptionalInput("commit"),
111111
hasPublishScript,
112112
createPrAsDraft: core.getBooleanInput("createPrAsDraft"),
113+
branch: getOptionalInput("branch"),
113114
});
114115

115116
core.setOutput("pullRequestNumber", String(pullRequestNumber));
116117

117118
return;
118119
}
119120
})().catch((err) => {
120-
console.error(err);
121+
core.error(err);
121122
core.setFailed(err.message);
122123
});

0 commit comments

Comments
 (0)