Skip to content
Permalink
Browse files
feat: delay github tag creation (#3330)
closes #3044
What happens is that, if the tag is created only locally, it'll create the tag in the remote upon creating the release. The tag still needs to be created locally though!
@bep let me know if that works for you.

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed Aug 21, 2022
1 parent ffb31b4 commit 95bba02211a2b88426826ff36a3fd1b424a1d5a7
Showing 1 changed file with 6 additions and 5 deletions.
@@ -217,11 +217,12 @@ func (c *githubClient) CreateRelease(ctx *context.Context, body string) (string,
body = truncateReleaseBody(body)

data := &github.RepositoryRelease{
Name: github.String(title),
TagName: github.String(ctx.Git.CurrentTag),
Body: github.String(body),
Draft: github.Bool(ctx.Config.Release.Draft),
Prerelease: github.Bool(ctx.PreRelease),
Name: github.String(title),
TagName: github.String(ctx.Git.CurrentTag),
TargetCommitish: github.String(ctx.Git.Commit),

This comment has been minimized.

Copy link
@bep

bep Aug 22, 2022

Contributor

Heads up: github.String is a string pointer, I suspect the 422 (or something) people got last time you tried this was because they had empty string values in their config, which is non-nil.

This comment has been minimized.

Copy link
@caarlos0

caarlos0 Aug 22, 2022

Author Member

commit comes from the context instead of config, so it'll always be a non-empty string now.

The only way I was able to reproduce the 422 was releasing from a commit that was not pushed to github... so maybe that was what happened, somehow (fetch-depth related maybe?)

in any case, if you wanna give this a try, let me know how it goes please :)

This comment has been minimized.

Copy link
@caarlos0

caarlos0 Aug 23, 2022

Author Member

Actually found one issue: if the code is in one repo, but the release is in another repo.

Common use case: private code, releases public.

Will make this optional, maybe accepting a template, so it can be empty, {{ .Git.Commit }}, main, etc

This comment has been minimized.

Copy link
@caarlos0

caarlos0 Aug 23, 2022

Author Member
Body: github.String(body),
Draft: github.Bool(ctx.Config.Release.Draft),
Prerelease: github.Bool(ctx.PreRelease),
}
if ctx.Config.Release.DiscussionCategoryName != "" {
data.DiscussionCategoryName = github.String(ctx.Config.Release.DiscussionCategoryName)

0 comments on commit 95bba02

Please sign in to comment.