Skip to content

Commit 8d9c011

Browse files
authored
Merge branch 'main' into feature/configurable-pr-body
2 parents dba71b6 + 0138f45 commit 8d9c011

7 files changed

Lines changed: 36 additions & 33 deletions

File tree

.changeset/sunny-moons-appear.md

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

.changeset/warm-teeth-listen.md

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

CHANGELOG.md

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

3+
## 2.1.2
4+
5+
### Patch Changes
6+
7+
- [#735](https://github.com/changesets/action/pull/735) [`8833883`](https://github.com/changesets/action/commit/88338839e35c3e0fa61f3c9c3f27e7572cd5f2cf) Thanks [@bluwy](https://github.com/bluwy)! - Handle error when pushing git tags with the git CLI
8+
9+
- [#724](https://github.com/changesets/action/pull/724) [`36f529f`](https://github.com/changesets/action/commit/36f529f13ab58bbcf6331035cb950385586e8a89) Thanks [@bluwy](https://github.com/bluwy)! - Improve log messages
10+
11+
- [#724](https://github.com/changesets/action/pull/724) [`36f529f`](https://github.com/changesets/action/commit/36f529f13ab58bbcf6331035cb950385586e8a89) Thanks [@bluwy](https://github.com/bluwy)! - Fix root action double error logs
12+
13+
- [#729](https://github.com/changesets/action/pull/729) [`ca85897`](https://github.com/changesets/action/commit/ca8589735af2ff6977a0f6474537d550040530d8) Thanks [@bluwy](https://github.com/bluwy)! - Always switch and reset branch when generating version commits, similar to if `push-with-git-cli` is enabled
14+
315
## 2.1.1
416

517
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@changesets/action",
3-
"version": "2.1.1",
3+
"version": "2.1.2",
44
"private": true,
55
"license": "MIT",
66
"type": "module",

src/github.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export class GitHub {
195195
if (authorIdentity.exitCode === 0 && committerIdentity.exitCode === 0) {
196196
return;
197197
}
198-
core.info("Setting Git user to github-actions[bot]");
198+
core.info("Setting git user to github-actions[bot]");
199199
await exec("git", ["config", "user.name", `"github-actions[bot]"`], {
200200
cwd: this.cwd,
201201
});
@@ -213,25 +213,27 @@ export class GitHub {
213213
}
214214

215215
async pushTag(tag: string) {
216-
if (!this.pushWithGitCli) {
217-
return this.octokit.rest.git
218-
.createRef({
216+
try {
217+
if (!this.pushWithGitCli) {
218+
await this.octokit.rest.git.createRef({
219219
...context.repo,
220220
ref: `refs/tags/${tag}`,
221221
sha: context.sha,
222-
})
223-
.catch((err) => {
224-
// Assuming tag was manually pushed in custom publish script
225-
core.warning(`Failed to create tag ${tag}: ${err.message}`);
226222
});
223+
} else {
224+
await exec("git", ["push", "origin", tag], {
225+
cwd: this.cwd,
226+
env: {
227+
...process.env,
228+
...(await this.#getCliAuthEnv()),
229+
} as Record<string, string>,
230+
});
231+
}
232+
} catch (err) {
233+
core.warning(
234+
`Failed to create git tag "${tag}". Assuming it was manually pushed by the publish script: ${(err as Error).message}`,
235+
);
227236
}
228-
await exec("git", ["push", "origin", tag], {
229-
cwd: this.cwd,
230-
env: {
231-
...process.env,
232-
...(await this.#getCliAuthEnv()),
233-
} as Record<string, string>,
234-
});
235237
}
236238

237239
async prepareBranch(branch: string) {

src/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ async function main() {
6868
switch (true) {
6969
case !hasChangesets && !hasPublishScript:
7070
core.info(
71-
"No changesets present or were removed by merging release PR. Not publishing because no publish script found.",
71+
"No changesets present or were removed by merging version PR. Not publishing because publish-script is not set.",
7272
);
7373
return;
7474
case !hasChangesets && hasPublishScript: {
@@ -104,7 +104,7 @@ async function main() {
104104
}
105105

106106
if (result.exitCode !== 0) {
107-
core.error(
107+
throw new Error(
108108
`Publish command exited with code ${result.exitCode}${
109109
result.published
110110
? `, but some packages were published: ${result.publishedPackages
@@ -113,12 +113,11 @@ async function main() {
113113
: ""
114114
}`,
115115
);
116-
process.exit(result.exitCode);
117116
}
118117
return;
119118
}
120119
case hasChangesets && !hasNonEmptyChangesets:
121-
core.info("All changesets are empty; not creating PR");
120+
core.info("All changesets are empty. Not creating PR");
122121
return;
123122
case hasChangesets: {
124123
const { pullRequestNumber } = await runVersion({

src/run.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ export async function runVersion({
391391
head: `${context.repo.owner}:${versionBranch}`,
392392
base: branch,
393393
});
394-
core.info(
394+
core.debug(
395395
`Existing pull requests: ${JSON.stringify(
396396
existingPullRequests.data,
397397
null,
@@ -418,7 +418,7 @@ export async function runVersion({
418418
});
419419

420420
if (existingPullRequests.data.length === 0) {
421-
core.info("creating pull request");
421+
core.info("Creating pull request");
422422
const { data: newPullRequest } = await octokit.rest.pulls.create({
423423
base: branch,
424424
head: versionBranch,
@@ -434,7 +434,7 @@ export async function runVersion({
434434
} else {
435435
const [pullRequest] = existingPullRequests.data;
436436

437-
core.info(`updating found pull request #${pullRequest.number}`);
437+
core.info(`Updating found pull request #${pullRequest.number}`);
438438
const convertPullRequestToDraftMutation =
439439
prDraft === "always"
440440
? `

0 commit comments

Comments
 (0)