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

Automate changelog updates #533

Open
3 tasks
MisRob opened this issue Jan 25, 2024 · 21 comments
Open
3 tasks

Automate changelog updates #533

MisRob opened this issue Jan 25, 2024 · 21 comments
Assignees
Labels
automation help wanted Open source contributors welcome

Comments

@MisRob
Copy link
Member

MisRob commented Jan 25, 2024

Current workflow

  1. When opening a PR, developers are guided by the PR template to fill in the changelog section in the PR description
  2. Some time before the PR is merged, the changelog section from the PR description needs to be manually pasted to CHANGELOG. md. Otherwise, the changelog check action will fail on the PR and it can't be merged.

Screenshot from 2024-01-25 17-44-08

Expected automated workflow

  1. (same) When opening a PR, developers are guided by the PR template to fill in the changelog section
  2. Before merging a PR, the changelog check action checks that the changelog section is present in the PR template
  3. After merging a PR, the CHANGELOG.md in the main branch gets automatically updated with the changelog section from the just merged PR's decription

This will also mean that developers won't need to fill the PR number and link anymore since that could too be done by means of automation during updating CHANGELOG.md.

Benefits

  • Prevents conflicts on PRs
  • Easier PR review and merge process

Tasks

Guidance

  • For contributors who don't have admin permissions on our repositories, I recommend using their own test repository during the development process.
  • @rtibbles posted some tips motivated by another action but may apply here as well:

...I strongly suspect that our attempts to update a PR from an event triggered on a PR will continue to fail, due to the scoped permissions of the github token in the particular events that we are responding to. This is the same reason that for PR builds on Kolibri, I had to execute on completion of the workflow, rather than in the main build workflow (triggered by the PR): https://github.com/learningequality/kolibri/blob/release-v0.16.x/.github/workflows/pr_build_comment.yml#L4

Noting that depending on which events we're triggering on, this might affect automatic changelog updating also.

@MisRob MisRob added type: proposal New feature or request TODO: needs decisions Further discussion and planning necessary labels Jan 25, 2024
@KshitijThareja
Copy link
Contributor

Hi @MisRob. I understand that the team is yet to make decisions with regards to this issue, but it seems pretty interesting to me and I'd like to work on it if and whenever it is up for contributions. Please let me know if I can help with this one. Thanks :)

@rtibbles
Copy link
Member

I think we could make a special case for the dependabot PRs, and directly template the update to the CHANGELOG in the case of that specific user.

@MisRob
Copy link
Member Author

MisRob commented Jan 25, 2024

@rtibbles What would we do if a developer needed to have some input into it? (e.g. marking a breaking change) Would they need to open another PR to update that changelog item? I am not sure how often that will happen though.

Do you think that having an action add a comment on PRs wouldn't be helpful in this case? Originally, I suggested it to resolve the situation when people remove the changelog section from the PR description (happens) but then realized it could be applied to dependabot ones too. Reading your comment, for dependabot we could prefill the comment much more than for regular PRs.

@MisRob
Copy link
Member Author

MisRob commented Jan 25, 2024

Thanks @KshitijThareja, that'd be lovely! I will let you know after we figure out details. Contributors sometimes have trouble with GH actions due to permissions, but you could play around with it in your own test repository.

@MisRob
Copy link
Member Author

MisRob commented Jan 25, 2024

@rtibbles One disadvantage of using an automated comment is that contributors probably won't realize they need to fill it in. But well, each approach has its own issues, so not sure if it's such a big deal. Did you have any ideas how to deal with the deleted changelog section from the PR description?

@rtibbles
Copy link
Member

For dependabot, we can still manually edit the changelog after the fact, if it is breaking (on the PR itself).

I think we could make the action still error if the information is not filled in?

@MisRob
Copy link
Member Author

MisRob commented Jan 25, 2024

For dependabot, we can still manually edit the changelog after the fact, if it is breaking (on the PR itself).

Oh wait, from the previous discussions, I thought that CHANGELOG.md should be updated after we merge the PR, because of the conflicts. So I assumed that and tried to be careful about making sure everything's in place before we merge. I am not sure if I understood it well now.

@rtibbles
Copy link
Member

Oh true - that would make it easier in general. Right, the dependabot would be a bit of an edge case, and we'd have to follow up after merge if it needed editing.

We would probably want to fail if someone hadn't filled out the template in the PR though, as we want that filled in to make the automatic update.

@MisRob
Copy link
Member Author

MisRob commented Jan 25, 2024

Right, the dependabot would be a bit of an edge case, and we'd have to follow up after merge if it needed editing.

If we had an action that would post a comment to the PR with the changelog section (rather than having it in the PR description), than even on dependabot PRs we could still adjust it before merge. After the merge, an another action would take it and paste to the CHANGELOG.md.

@MisRob
Copy link
Member Author

MisRob commented Jan 25, 2024

And external contributors couldn't remove this comment from regular PRs. So it'd solve missing changelog section. However, I'm not sure if they could edit it, actually... So perhaps it's a bad idea.

@MisRob
Copy link
Member Author

MisRob commented Jan 25, 2024

We would probably want to fail if someone hadn't filled out the template in the PR though, as we want that filled in to make the automatic update.

By this you meant that we would update the current changelog check action to check for the presence of the changelog item in the PR description (rather than checking on CHANGELOG.md)?

@rtibbles
Copy link
Member

Yes.

@MisRob
Copy link
Member Author

MisRob commented Jan 25, 2024

Okay, I will update the issue. I realized that the comment idea wouldn't work due to permissions for majority of PRs. Hopefully we won't have braking changes on dependabot PRs too often. And the template check will prevent from missing changelog item. So sounds like a path forward. Thanks for discussing.

@MisRob MisRob added help wanted Open source contributors welcome and removed type: proposal New feature or request TODO: needs decisions Further discussion and planning necessary labels Jan 25, 2024
@MisRob
Copy link
Member Author

MisRob commented Jan 25, 2024

Updated! @rtibbles if you'd like to read through the final version, I'd appreciate it.

@MisRob
Copy link
Member Author

MisRob commented Jan 25, 2024

@KshitijThareja After @rtibbles confirms, I think you'd be welcome to give it a try. Please let us know if it's all clear. GH actions development can be tricky, I heard :) As mentioned, my recommendation would be to try it on your own test repository to prevent from permissions troubles.

@MisRob
Copy link
Member Author

MisRob commented Jan 25, 2024

Alright, we agreed this is ready to go. @KshitijThareja I updated the issue a lot. If you're interested, let us know and I can assign you. Thank you!

@KshitijThareja
Copy link
Contributor

Sure @MisRob, I'm interested in working on this issue.

@MisRob
Copy link
Member Author

MisRob commented Jan 26, 2024

Thanks @KshitijThareja, I will assign you then.

@KshitijThareja
Copy link
Contributor

Hi @MisRob!
Just an update on this issue. I've completed most of the work. I've updated the the changelog check action to check for presence of the changelog item in the PR description. I am almost done with changelog update workflow and currently testing it in my own repository.
I expect to make a PR this week, if all goes well.

@MisRob
Copy link
Member Author

MisRob commented Feb 13, 2024

Hi @KshitijThareja, thanks, that's wonderful

@KshitijThareja
Copy link
Contributor

Hi @MisRob
I've linked a PR for this issue. I'd love to hear your feedback on the changes introduced.
Thanks : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation help wanted Open source contributors welcome
Projects
None yet
Development

No branches or pull requests

3 participants