-
-
Notifications
You must be signed in to change notification settings - Fork 402
Always push tags with the github api #672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@changesets/action": patch | ||
| --- | ||
|
|
||
| Always push tags with the GitHub API |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,25 +114,16 @@ export class GitHub { | |
| } | ||
|
|
||
| async pushTag(tag: string) { | ||
| 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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], { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) { | ||
|
|
||
There was a problem hiding this comment.
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