Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cool-rules-shine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/action": patch
---

Handle error when pushing git tags with the git CLI
29 changes: 15 additions & 14 deletions src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,25 +213,26 @@ export class GitHub {
}

async pushTag(tag: string) {
if (!this.pushWithGitCli) {
return this.octokit.rest.git
.createRef({
try {
if (!this.pushWithGitCli) {
await this.octokit.rest.git.createRef({
...context.repo,
ref: `refs/tags/${tag}`,
sha: context.sha,
})
.catch((err) => {
// Assuming tag was manually pushed in custom publish script
core.warning(`Failed to create tag ${tag}: ${err.message}`);
});
} else {
await exec("git", ["push", "origin", tag], {
cwd: this.cwd,
env: {
...process.env,
...(await this.#getCliAuthEnv()),
} as Record<string, string>,
});
}
} catch (err) {
// Assuming tag was manually pushed in custom publish script
core.warning(`Failed to create tag ${tag}: ${(err as Error).message}`);
Comment thread
bluwy marked this conversation as resolved.
Outdated
}
await exec("git", ["push", "origin", tag], {
cwd: this.cwd,
env: {
...process.env,
...(await this.#getCliAuthEnv()),
} as Record<string, string>,
});
}

async prepareBranch(branch: string) {
Expand Down