Skip to content

Conversation

@dawidgora
Copy link

@dawidgora dawidgora commented Nov 18, 2025

Similar to GitHub, release notes can now be generated automatically.
The generator is server-side and gathers the merged PRs and contributors and returns the corresponding Markdown text.

Screenshots

Brave Browser 2025-11-18 18 53 36 Brave Browser 2025-11-18 18 53 44 Brave Browser 2025-11-18 18 52 10 Brave Browser 2025-11-18 18 52 22

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 18, 2025
@github-actions github-actions bot added modifies/translation modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/frontend labels Nov 18, 2025
@lunny lunny added this to the 1.26.0 milestone Nov 19, 2025
@dawidgora dawidgora force-pushed the feat/automatic-generation-of-release-notes branch from d36f97f to f32b963 Compare November 19, 2025 08:59
dawidgora added a commit to dawidgora/gitea that referenced this pull request Nov 19, 2025
@wxiaoguang
Copy link
Contributor

Also cc @techknowlogick for further review and help (#35976 (comment)) , in case you already have more discussions.

@dawidgora
Copy link
Author

In 1406ccc:

  • Added helpers so release notes pick the release immediately before the one being edited, not just the latest one
  • This avoids errors when updating notes on older releases because we now compare against the correct predecessor tag.

@dawidgora
Copy link
Author

In followup PR, when I find some time I will implement additional configuration for this feature, like it is on GitHub: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Nov 19, 2025

Too many unnecessary if and ? for "defensive programming"
Most of them should be removed. If you write a if or ? , then you should clearly know that in which case it can happen.

Still many if and ? in code that I don't understand.


And #35977 (comment)

Also cc techknowlogick for further review and help (#35976 (comment)) , in case you already have more discussions.

@wxiaoguang wxiaoguang removed their request for review November 19, 2025 12:44
@dawidgora
Copy link
Author

dawidgora commented Nov 19, 2025

Too many unnecessary if and ? for "defensive programming"
Most of them should be removed. If you write a if or ? , then you should clearly know that in which case it can happen.

Still many if and ? in code that I don't understand.

Ok, I made it less defensive now @wxiaoguang

And #35977 (comment)

Also cc techknowlogick for further review and help (#35976 (comment)) , in case you already have more discussions.

We haven't, but @techknowlogick feel free to review my PR

@dawidgora dawidgora requested a review from wxiaoguang November 19, 2025 13:14
Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, still questions (only a quick look, not carefully look into backend code yet)

@dawidgora dawidgora requested a review from wxiaoguang November 19, 2025 14:50
dawidgora added a commit to dawidgora/gitea that referenced this pull request Nov 20, 2025
@wxiaoguang
Copy link
Contributor

A UX problem:

If user has input many message in the textarea, then click the "Generate release notes" button, then their work is lost and no way to undo?

Is it better to "append" but not "replace"?

Comment on lines 251 to 260
func parseSemanticVersion(tag string) *version.Version {
tag = strings.TrimSpace(tag)
tag = strings.TrimPrefix(tag, "v")
tag = strings.TrimPrefix(tag, "V")
v, err := version.NewVersion(tag)
if err != nil {
return nil
}
return v
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it support tag name with fields? For example: releases/v1.0

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good idea. What would you say if, in such a case, it needed to match the same field as the currently created tag?

For example, if we are creating a new release with the tag release/v1.1.0, it would look for release/v1.0.0, but not for nightly/1.0.0.

Or maybe it’s overengineering, and we should keep it simple. Let me know how you see it, and I can adjust the logic.

Copy link
Contributor

@wxiaoguang wxiaoguang Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should remove the "Auto" feature, and always let end users choose?

We can make a best guess (only compare the last field) to make the latest tag to be selected by default on the UI. It could also simplify the code.

And users can clearly know what would happen

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll do it like this. I hope to find some time today, but can't promise

@dawidgora
Copy link
Author

Okay, I see. I assume it currently collects commits. In the future, we could consider adding an option to collect either commits or pull requests.

It's practically useless to me when it does not include commits without a associated pull request, as I think that's a very common scenario, for example when the repo owner does fixups etc.

But if it matches GH (it seems so), I won't block on it.

I can implement that in the following PR, along with other improvements. But first, I'd like to have this one merged.

@silverwind
Copy link
Member

silverwind commented Dec 5, 2025

Okay, I see. I assume it currently collects commits. In the future, we could consider adding an option to collect either commits or pull requests.

It's practically useless to me when it does not include commits without a associated pull request, as I think that's a very common scenario, for example when the repo owner does fixups etc.
But if it matches GH (it seems so), I won't block on it.

I can implement that in the following PR, along with other improvements. But first, I'd like to have this one merged.

Fine with me.

@silverwind
Copy link
Member

silverwind commented Dec 5, 2025

Branch needs to be updated and it will likely have some new typescript issues because we enabled strictNullChecks in #35843.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Dec 6, 2025

A UX problem:

If user has input many message in the textarea, then click the "Generate release notes" button, then their work is lost and no way to undo?

Is it better to "append" but not "replace"?

Just tested with GitHub, it "resolves" this problem by disabling the generation when the textarea is not empty:

Details image

ps: GitHub has more logic for the "generation", I didn't mean that we must follow GitHub, while I think at least we should avoid surprising end users. Maybe using a modal dialog is better, then the UI can be simplified and more options can be added in the future (for example: add a checkbox to also add commit messages without a PR)

@wxiaoguang

This comment was marked as resolved.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Dec 13, 2025

Now a new question about "new tag without previous tag"

Details
func findInitialCommit(commit *git.Commit) (*git.Commit, error) {
	// FIXME: this method is inefficient for large repos with long histories, and it doesn't seem right:
	// FIXME: "git diff aaaa...bbbb" doesn't include commits from "aaaa", so the changes in "root commit" won't appear in the tag release's diff.
	// No idea whether we should really make things so complicated.

GitHub:

image

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Dec 16, 2025

Made some new changes and addressed the concerns above (by my understanding).

New changes


New screenshots

Details image image

@wxiaoguang wxiaoguang marked this pull request as ready for review December 16, 2025 08:55
@wxiaoguang wxiaoguang added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Dec 16, 2025
@dawidgora
Copy link
Author

Thank you for wrapping it up @wxiaoguang, I was busy lately.. One thing: I don't think moving previous tag selections saves any space. UX was better without modal IMO

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Dec 16, 2025

One thing: I don't think moving previous tag selections saves any space. UX was better without modal IMO

IMO the new layout seems better and clearer (ps: I think it does save some space because we don't need to put a 38px height dropdown there, now we only have a tiny button, it's also easier for mobile layout)

And there are more reasons for why a modal does better in my mind:

  • The elements in the form are usually related to the form and will be submitted. If we put the "previous tag" selector in the "release note form", it looks strange because the selector's value isn't for the form.
  • Putting "previous tag" in the form (like GitHub) makes the logic much more complex than it should be. I have tested GitHub's release edit page, it sometimes hides something, sometimes disables something, and it needs to sync the states for different inputs. Overall the GitHub's design looks not good to me.

When using a modal for "generate release notes", the logic is clearer than before:

  • The "previous tag" won't be displayed in the form, then it won't mislead users.
  • The user first chooses a target tag, then use the modal to choose a previous tag. When the modal is open (just one more click), the target tag is determined, then not like GitHub which does a lot of tricks to sync the states.
  • We don't need to use "auto" anymore since the target tag is determined, users can clearly know which tag will be used for previous tag: a determined behavior.
  • The code can be simplified, less code, fewer bugs :)

So the modal dialog seems to be the best choice at the moment in my mind, while I am also open for other better solutions.


Old New
image image

@dawidgora
Copy link
Author

Fair enough. Is there anything else here left to do?

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Dec 16, 2025

Is there anything else here left to do?

No from my side. Maybe we can leave it open for some time in case other maintainers would have suggestions.

If nothing more to change, I think we can get it merged in one or two days.

Thank you very much for this awesome feature!

@delvh delvh changed the title feat: automatic generation of release notes Automatic generation of release notes Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/dependencies modifies/frontend modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/translation type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants