-
Notifications
You must be signed in to change notification settings - Fork 416
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
Automating changelog maintenance #1182
Comments
@rmacklin this generally sounds good to me. How do you suggest automating the changelog? For what it's worth, we've basically just copied what Rails does, which is manually writing entries 🤷🏻 |
Seems to me like the solution would be a GitHub Action - it'd takes the contents of a squash commit after a merge and append them to the changelog under the |
I think the main difference with Rails is the first bullet - Rails doesn't require all changes to have a changelog entry (in fact it's explicitly discouraged for "refactorings and documentation changes" to have changelog entries) I suppose it's open for discussion if we want to continue the practice of requiring every single PR to have a changelog entry. As noted in the issue, that practice combined with the practice of squash-merging all PRs effectively makes it such that the changelog is almost equivalent to the repository's commit log. Given that perceived redundancy, should we consider treating the changelog differently, more akin to how Rails does? From the perspective of consumers of ViewComponent who are upgrading to a new version, the current process could be seen as suboptimal, where the changes that don't affect the runtime are adding "noise" to the changelog. And if the changelog scope was reduced, the repository's commit log and contributor data would still provide recognition for each contribution. So, I think it's a valid question... But I opened this issue assuming we would keep the current practices. If we do, I was thinking of extending the release script to handle inserting the new changes for each new release. Unreleased changes wouldn't appear in the changelog, though we could include a link to those at the top of the changelog. I can throw something together to illustrate what I'm envisioning, but definitely let me know if you're considering changing the scope of the changelog, as that would make it less straightforward to implement (though still doable, I think). |
I considered a GitHub Action, too, but I think handling it in the release script might be simpler and cleaner - particularly since the release script is already modifying the changelog. |
I found github-changelog-generator on my travels. That's one potential option. It looks as though it's potentially configurable to the point of being identical to what we have now. I'll have a play with it and see what I can do. |
I got pretty decent results by calling it as follows:
It comes back looking a little something like this:# Changelog
## [Unreleased](https://github.com/github/view_component/tree/HEAD)
[Full Changelog](https://github.com/github/view_component/compare/v2.47.0...HEAD)
- Fix style in generator docs [\#1228](https://github.com/github/view_component/pull/1228) (@Spone)
- Fix ruby 3.0 CI [\#1224](https://github.com/github/view_component/pull/1224) (@Spone)
- Add ViewComponent::Collection to @param of \#render\_inline [\#1215](https://github.com/github/view_component/pull/1215) (@yykamei)
- Make ViewComponent::Collection a collection [\#1178](https://github.com/github/view_component/pull/1178) (@sammyhenningsson)
## [v2.47.0](https://github.com/github/view_component/tree/v2.47.0) (2021-12-20)
[Full Changelog](https://github.com/github/view_component/compare/v2.46.0...v2.47.0)
- release 2.47.0 [\#1214](https://github.com/github/view_component/pull/1214) (@joelhawksley)
- Add the WEBrick gem to the docs app [\#1211](https://github.com/github/view_component/pull/1211) (@cpjmcquillan)
- Update `.tool-versions` to latest Ruby version [\#1209](https://github.com/github/view_component/pull/1209) (@cpjmcquillan)
- Add test for a lambda slot with a block and no other arguments [\#1208](https://github.com/github/view_component/pull/1208) (@boardfish)
- Add test for trailing newline with `render_in` [\#1207](https://github.com/github/view_component/pull/1207) (@boardfish)
- Add file consistency linters [\#1206](https://github.com/github/view_component/pull/1206) (@boardfish)
- Add @boardfish to docs index [\#1201](https://github.com/github/view_component/pull/1201) (@boardfish)
- Set up Codespaces for bug replication [\#1200](https://github.com/github/view_component/pull/1200) (@boardfish)
- Make @boardfish a committer [\#1191](https://github.com/github/view_component/pull/1191) (@joelhawksley)
- Ensure component delegation slots can use helpers [\#1187](https://github.com/github/view_component/pull/1187) (@BlakeWilliams)
- Remove broken `files` options from vale config [\#1186](https://github.com/github/view_component/pull/1186) (@Spone)
- Improve instructions on how to run tests [\#1185](https://github.com/github/view_component/pull/1185) (@Spone)
- Add `--locale` flag to the component generator [\#1183](https://github.com/github/view_component/pull/1183) (@bobmaerten)
- Move changelog entry for \#1162 to the right version [\#1181](https://github.com/github/view_component/pull/1181) (@rmacklin)
- Update ruby to the latest versions [\#1176](https://github.com/github/view_component/pull/1176) (@VSPPedro)
- Add failing test for default form builder [\#1090](https://github.com/github/view_component/pull/1090) (@boardfish)
- \[1029\] Preview the source of templates when exclusively used [\#1047](https://github.com/github/view_component/pull/1047) (@edwinthinks)
- Validate collection parameter with Active Record attribute names [\#971](https://github.com/github/view_component/pull/971) (@boardfish) For comparison, here's the current changelog:---
layout: default
title: Changelog
---
# Changelog
## main
* Return correct values for `request.path` and `request.query_string` methods when using the `with_request_url` test helper.
*Vasiliy Matyushin*
* Improve style in generators docs.
*Hans Lemuet*
* Correctly type Ruby version strings and update Rails versions used in CI configuration.
*Hans Lemuet*
* Make `ViewComponent::Collection` act like a collection of view components
*Sammy Henningsson*
* Update `@param` of `#render_inline` to include `ViewComponent::Collection`.
*Yutaka Kamei*
## 2.47.0
* Display preview source on previews that exclusively use templates.
*Edwin Mak*
* Add a test to ensure trailing newlines are stripped when rendering with `#render_in`.
*Simon Fish*
* Add WEBrick as a depenency to the application.
*Connor McQuillan*
* Update Ruby version in `.tool-versions`.
*Connor McQuillan*
* Add a test to ensure blocks can be passed into lambda slots without the need for any other arguments.
*Simon Fish*
* Add linters for file consistency.
*Simon Fish*
* Add @boardfish to docs/index.md and sort contributors.
*Simon Fish*
* Set up Codespaces for bug replication.
*Simon Fish*
* Add instructions for replicating bugs and failures.
*Simon Fish*
* Make @boardfish a committer.
*Joel Hawksley*
* Validate collection parameter with Active Model attribute names.
*Simon Fish*
* Fix `helpers` not working with component slots when rendered more than 2 component levels deep.
*Blake Williams*
* Update ruby to the latest versions
*Pedro Paiva*
* Fix `vale` linter config options.
*Hans Lemuet*
* Improve Contributing docs to include how to run tests for a specific version on Rails.
*Hans Lemuet*
* Add failing test for default form builder and documentation around known issue.
*Simon Fish*
* Add `--locale` flag to the component generator. Generates as many locale files as defined in `I18n.available_locales`, alongside the component.
* Add config option `config.view_component.generate_locale` to enable project-wide locale generation.
* Add config option `config.view_component.generate_distinct_locale_files` to enable project-wide per-locale translations file generation.
*Bob Maerten* Note that it's possible to add YAML front matter, but I didn't realise we needed it until after running the script. I'm aware of a few discrepancies:
However, there's also nothing stopping me (or anyone else) from extending Here's what I'd suggest:
I might be overcomplicating things a touch, but what do folks think? |
Happy to have a conversation around this, but personally I'm 👍 on going by username. The thought being that there's several If we still want to use full names, I wonder if we could get it from the commit since that information should be present there. Overall I'm 👍 on that approach though! |
That's a fair point. There's also the argument that folks' identities can change with time, and their username is the closest thing we've got to a unique identifier that will follow them with time. It does give me a lot of personal satisfaction to see my name as opposed to my username in there, but I think it would be a sensible decision to move from that. |
Apologies that it took me a while to get back to this, but I've drafted a PR outlining this approach in #1259. It could still use a bit of polish but I wanted to push it up to illustrate the approach more concretely. Curious to get your thoughts on it - personally, I like it more than having a bot generate a commit to update the changelog between every real commit, and I think:
is a fine tradeoff. |
#1247 was the sort of issue that could quickly be resolved with an overview of unreleased changes in I think you're right that the commit history shouldn't be plagued with changelog updates, but I still feel that the changelog should be updated after every PR that goes in. If there's a way to do that without generating a commit against |
👋🏻 reading this through, my main take away is that we might just be shifting the burden of contribution from the changelog to the writing of commit messages/PR titles. Given this discussion, I wonder if we might just want to remove the changelog build requirement and leave it as a suggestion in the contributing docs. We can always ask folks to add an entry if they have omitted one for a material change. I really appreciate the discussion here and the proposed PRs ❤️ |
I think that could be a quick way to improve the current situation. The problem we're trying to solve is that updating the changelog isn't a frictionless process, since it's subject to merge conflicts. I'll admit that my first shot at solving this was perhaps a little heavy-handed with that in mind. With that in mind, I think the most direct way to solve this in full is to ensure that a rebase, followed by a changelog update, is the last thing that happens before a merge. Maybe what that means is the current requirement for a changelog update should stay, but that it should only be enforced by maintainers after a PR is otherwise ready to go? |
I think it's specifically PR titles rather than commit messages (for a single-commit PR, the commit message subject does get auto-filled as the default PR title, but it can be changed). I actually considered this shift as a benefit because it's very easy (for contributors and maintainers alike) to change a PR title. In the past, I've seen maintainers ask for modifications to the changelog entry, which requires a new commit that consequently enqueues the whole CI matrix again. With the alternative approach, that could be avoided: If the only thing left to do before merging is reword the change summary, a reviewer could edit the PR title and then click merge in a matter of seconds. Additionally (and perhaps more significantly), if changelog entries are sourced from PR titles, these issues would no longer exist:
And I think changelog automation would also be able to solve for this other issue:
(which I didn't include in my initial PR, but is a simple addition) as well as the add-on benefit of including PR numbers with each change. But with all that said, I'm fine if we don't want to pursue changelog automation. Especially given this suggestion:
because if we are no longer requiring entries for changes that aren't material to the actual runtime, that would at least reduce the potential for merge conflicts. And like I was saying in #1182 (comment), the repository's commit log and contributor data would still provide recognition for each contribution. But I agree with @boardfish that it may be beneficial to update the contributing guidelines to suggest a changelog update as the final step after the branch has been rebased on (or merged with) the latest |
If we do still want to automate this element, I have a potential solution with the above in mind. This'll be a workflow, and we have the option to make it required or not.
The criteria for triggering it manually could be one of several things:
I also contemplated doing it just before a merge, but I'm not sure that's possible without tampering with |
I haven't spent as much time studying this as you have, but I just found this https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuration-options I'm wondering if there is a way to leverage this configuration (which is based on labels) to determine which changes go to an automatically generated changelog, and maybe "editorialize" the changelog as well (with headings such as Breaking changes, Added, Deprecated, Experimental...) |
The change log doesn't need to be a file. Could just point to the releases page https://github.com/ViewComponent/view_component/releases |
@joeldrapper I'm hesitant to not have something in source control, as it allows us to require PR authors to provide a changelog entry. As of now I'd be most keen on using something like https://github.com/changesets/changesets, albeit with different release notes styling. |
After #1181, I'd like to suggest automating the maintenance of ViewComponent's changelog.
While I love a good hand-crafted changelog, I think the conventions already in place in this repository make it worthwhile to pursue changelog automation:
main
Those conventions make
git log
a good fit for changelog generation.Automating the changelog management would solve a few issues:
CHANGELOG.md
is a frequent source of merge conflicts among the PRs that aren't merged in a short window.CHANGELOG.md
. (Move changelog entry for #1162 to the right version #1181)/CHANGELOG.md
as a symlink to/docs/CHANGELOG.md
, which doesn't work for some tools (CHANGELOG.md looks like an empty file without any links #1170).suggestion
and committing it (two steps, with an extra CI run), maintainers can just edit the PR title or the squash commit message.git log
would have that covered.Thoughts?
The text was updated successfully, but these errors were encountered: