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
@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

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

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:

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)

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