Skip to content

Commit 6469652

Browse files
committed
fix: create tags implicitly through release api
1 parent 7f0270e commit 6469652

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

.changeset/nervous-eggs-bathe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/action": minor
3+
---
4+
5+
Reduce the number of API calls when releasing with `commitMode: github-api`

src/git.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,8 @@ export class Git {
6262

6363
async pushTag(tag: string) {
6464
if (this.octokit) {
65-
return this.octokit.rest.git
66-
.createRef({
67-
...github.context.repo,
68-
ref: `refs/tags/${tag}`,
69-
sha: github.context.sha,
70-
})
71-
.catch((err) => {
72-
// Assuming tag was manually pushed in custom publish script
73-
core.warning(`Failed to create tag ${tag}: ${err.message}`);
74-
});
65+
// a tag will be created automatically when creating a release
66+
return;
7567
}
7668
await exec("git", ["push", "origin", tag]);
7769
}

src/run.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const createRelease = async (
4444
await octokit.rest.repos.createRelease({
4545
name: tagName,
4646
tag_name: tagName,
47+
target_commitish: github.context.sha,
4748
body: changelogEntry.content,
4849
prerelease: pkg.packageJson.version.includes("-"),
4950
...github.context.repo,

0 commit comments

Comments
 (0)