Skip to content

Commit 0b458f0

Browse files
committed
fix: create tags implicitly through release api
1 parent e82f42c commit 0b458f0

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

.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
@@ -77,16 +77,8 @@ export class Git {
7777

7878
async pushTag(tag: string) {
7979
if (this.octokit) {
80-
return this.octokit.rest.git
81-
.createRef({
82-
...github.context.repo,
83-
ref: `refs/tags/${tag}`,
84-
sha: github.context.sha,
85-
})
86-
.catch((err) => {
87-
// Assuming tag was manually pushed in custom publish script
88-
core.warning(`Failed to create tag ${tag}: ${err.message}`);
89-
});
80+
// a tag will be created automatically when creating a release
81+
return;
9082
}
9183
await exec("git", ["push", "origin", tag], { cwd: this.cwd });
9284
}

src/run.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const createRelease = async (
5050
await octokit.rest.repos.createRelease({
5151
name: tagName,
5252
tag_name: tagName,
53+
target_commitish: github.context.sha,
5354
body: changelogEntry.content,
5455
prerelease: pkg.packageJson.version.includes("-"),
5556
...github.context.repo,

0 commit comments

Comments
 (0)