-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add program to generate changelog release entries #2626
Conversation
7bde8ef
to
b5fb99a
Compare
@hiddeco I guess we could reuse this for the Helm Operator as well? Should I put it in a separate repo? |
@2opremio yes, this can definitely be reused by the Helm operator. May require a slight rework of the |
beed353
to
af4811a
Compare
This Go program uses the GitHub API to automate the arduous task of creating a changelog entry for an upcoming release. It: * Automatically obtains the tag of the latest release (to know from what commit to start looking for Pull Requests). * Identifies pull requests * Attempts to categorize pull requests in subsections using tags * Generates the list of contributors
50cd290
to
1282c3b
Compare
I decided against moving this to a new repo (it didn't feel right to create a repo just for this). I did add flags to make it runnable to for the helm operator by just providing |
1282c3b
to
3706533
Compare
prs := []*github.PullRequest{} | ||
visitedPRs := map[int]struct{}{} | ||
for _, commit := range commits { | ||
commitProcessHook() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not super happy about this. It seems rather artificial. The alternative I considered is returning a channel and running asynchronously, but I think that's a bit overkill.
// Note: Unfortunately this will return all the PRs whose head branch contains the commit | ||
// (i.e. not just the PR which incorporates the commit to the base repo). | ||
// We deal with this by discarding duplicates. | ||
prsForCommit, _, err := ghClient.PullRequests.ListPullRequestsWithCommit(ctx, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling this on every commit is very slow (that's why I added the progress bar). As an alternative we could parse the commit messages looking for Merge
messages (and messages ending with #number
for rebased PRs, which don't have a Merge message). However, I deemed that to be a bit too fragile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can look for commits with more than one parent. That will catch all PR merges except those that are fast-forwards, which should be none.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will catch all PR merges except those that are fast-forwards, which should be none.
We explicitly disable that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I believe so. (But of course, that may change, you never know)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I would rather not make assumptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Work and does a handy task 🍍 Can we move it to a less ugly path? :-)
Sure! What do you suggest? |
Maybe we could have:
(of which, only the latter matters here) |
43e1056
to
b022fbc
Compare
This Go program uses the GitHub API to automate the arduous task of creating a changelog entry for an upcoming release.
It:
I still need to clean the code up before it's ready to merge (e.g. there's a hugemain()
function)