Skip to content

Conversation

@dawidgora
Copy link

@dawidgora dawidgora commented Nov 18, 2025

Add GitHub-style automatic release notes generation

  • Add server-side release notes generator that discovers the base tag, gathers merged PRs and contributors, and returns formatted Markdown plus the selected previous tag for reuse.
  • Expose a /releases/generate-notes endpoint with form validation, localization strings, and UI wiring (button, previous-tag dropdown, JS handler) on the new release page to trigger note generation.
  • Cover the generator with unit tests for default and tag-fallback flows.

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
@dawidgora dawidgora force-pushed the feat/automatic-generation-of-release-notes branch from 4f38868 to 86e0035 Compare November 24, 2025 07:59
@dawidgora dawidgora requested a review from wxiaoguang November 24, 2025 10:25
@wxiaoguang
Copy link
Contributor

Thank you for your updates.

I've been very busy lately, so don't have enough time to do a full test and review at the moment. Meanwhile other maintainers can help to review.

@wxiaoguang wxiaoguang removed their request for review November 24, 2025 12:13
@lunny
Copy link
Member

lunny commented Nov 26, 2025

It seems no commits listed when I tested it locally.
image

@dawidgora
Copy link
Author

dawidgora commented Nov 27, 2025

It seems no commits listed when I tested it locally.

@lunny It only works for pull requests. Did you have them, or just commits? It mimics the Github behavior.

@lunny
Copy link
Member

lunny commented Nov 27, 2025

It seems no commits listed when I tested it locally.

@lunny It only works for pull requests. Did you have them, or just commits? It mimics the Github behavior.

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.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 27, 2025
@silverwind
Copy link
Member

silverwind commented Nov 28, 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.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Nov 28, 2025

A quick test, UI is broken

image

Update: fixed in new commits

@wxiaoguang wxiaoguang marked this pull request as draft November 28, 2025 00:36
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Nov 28, 2025

And the UI now looks really strange. (maybe an old problem).

And the new input & button take too much space IMO, maybe need some new design

image

@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

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/frontend modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/translation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants