Skip to content
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

Support annotated tags when using create release API #31840

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kemzeb
Copy link
Contributor

@kemzeb kemzeb commented Aug 15, 2024

This adds a new field, "tag_message", that represents the message of the annotated tag.

Resolves #31835.

This adds a new field, "tag_message", that represents the message
of the annotated tag.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 15, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 15, 2024
@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code labels Aug 15, 2024
@kemzeb
Copy link
Contributor Author

kemzeb commented Aug 15, 2024

Currently we don't return the tag message in the response. We don't store the tag message in the Release model, so that would mean we would have to either:

  • Communicate to git in order to get this
  • Store the tag message in the database
  • Don't include it in the response

I looked to see what the other forges were doing, and it appears that GitLab doesn't expose a similar field in its API response. See here.

@lunny
Copy link
Member

lunny commented Aug 16, 2024

How about reuse body as tag message? This is a non-compatible API change with Github API v3 https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release

@kemzeb
Copy link
Contributor Author

kemzeb commented Aug 16, 2024

Done, though the problems I see with this is that:

  • Both the release note and the tag message will be the same
  • You can't create lightweight tags if you have a release note

Not sure if these are potential problems

@lunny
Copy link
Member

lunny commented Aug 16, 2024

Looks like Github API doesn't support to create tag.

lunny pushed a commit that referenced this pull request Sep 12, 2024
A 500 status code was thrown when passing a non-existent target to the
create release API. This snapshot handles this error and instead throws
a 404 status code.

Discovered while working on #31840.
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Sep 14, 2024
A 500 status code was thrown when passing a non-existent target to the
create release API. This snapshot handles this error and instead throws
a 404 status code.

Discovered while working on go-gitea#31840.
yp05327 pushed a commit that referenced this pull request Sep 17, 2024
Backport #31841 by @kemzeb

A 500 status code was thrown when passing a non-existent target to the
create release API. This snapshot handles this error and instead throws
a 404 status code.

Discovered while working on #31840.

Co-authored-by: Kemal Zebari <[email protected]>
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Sep 23, 2024
@lunny
Copy link
Member

lunny commented Sep 23, 2024

I noticed in web router, the msg is

		msg := ""
		if len(form.Title) > 0 && form.AddTagMsg {
			msg = form.Title + "\n\n" + form.Content
		}

Which has a different implementation between web and this API.

@kemzeb
Copy link
Contributor Author

kemzeb commented Sep 23, 2024

I'm still not sure if its desirable to have both the tag message and the release description be the same. I also experimented with the GitHub API, and there really doesn't seem to be a way to create an annotated tag with this endpoint (even when specifying the body field).

This does look like it has been a sought after feature though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating a release via the API should allow for creating an annotated tag
4 participants