Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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/solid-peas-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/action": patch
---

Always push tags with the GitHub API
27 changes: 9 additions & 18 deletions src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,16 @@ export class GitHub {
}

async pushTag(tag: string) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a comment here explaining why we are not using the git CLI at all here

if (this.commitMode === "github-api") {
return 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}`);
});
try {
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, it's pretty crucial for those tags to be created so we can create github releases properly. I know this is preexisting - but it would be great if we could only swallow specific errors here.

core.warning(`Failed to create tag ${tag}: ${(err as Error).message}`);
}
await exec("git", ["push", "origin", tag], {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, how sure are we this new flow will resolve the issue. The previous code wasn't exactly pushing all tags at once either, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm actually you might be right. I'm checking the timeline and we were pushing all git tags at once up until #391 which refactors to call them separately in parallel. After that's merged, we haven't got comments of it not working, so I guess it's fixed?

I was assuming since we push in parallel, GitHub might still detect it, and the REST API is able to workaround it. But maybe this isn't a problem now. I haven't personally tested this manually.

cwd: this.cwd,
env: {
...process.env,
...this.#getCliAuthEnv(),
} as Record<string, string>,
});
}

async prepareBranch(branch: string) {
Expand Down