Automatically generate contributor list for releases#11120
Conversation
|
✅ Validation Passed: All report and feature-flag labels are correctly set. |
|
@stephenking314 We're working on changing our in app changelog implementation. Please have a look at: RFC and technical design TLDR, we want to get rid of the XML format and use a JSON version defined in the above docs. It should be closer to Feel free to comment. |
|
@wmontwe Those changes seem reasonable and it shouldn't be a big impact to the notes generation since we use an xml template file to generate the current changelog used in the app. Switching over to use a json format should be simple, and we already have separate template files for github notes and the short form notes submitted to play store. Just a quick note about this PR, in case it isn't clear. This addition is only for the github release notes. |
| def github_compare(repo, older, newer): | ||
| commits = [] | ||
|
|
||
| url = f"https://api.github.com/repos/{repo}/compare/{older}...{newer}" | ||
|
|
||
| while True: | ||
| response = github_get(url) | ||
| data = response.json() | ||
|
|
||
| page_commits = data.get("commits", []) | ||
| commits.extend(page_commits) | ||
|
|
||
| if "next" in response.links: | ||
| url = response.links["next"]["url"] | ||
| else: | ||
| break | ||
|
|
||
| return commits |
There was a problem hiding this comment.
Probably not a big deal, but I believe the /compare API does not provide pagination. Instead the amount of commits is capped at 250, so this will always break at first iteration.
A way to confirm this is by running a compare against an old and recent tag:
curl -v https://api.github.com/repos/thunderbird/thunderbird-android/compare/THUNDERBIRD_12_1...THUNDERBIRD_20_0b2 > /tmp/git-compare.json
This has over 2.5k commits, but only 250 are returned.. No pagination.
There was a problem hiding this comment.
I was missing the hook to enable pagination, which is ?per_page=x. I actually had this earlier but accidentally dropped it while doing a refactor. What you pointed out is correct, without pagination the results are capped at 250 commits, which could end up cutting out contributors between major revisions.
| first_contributions = get_first_contributions(repo, contributors) | ||
|
|
||
| contributors = {f"@{author}" for author in contributors} | ||
| excludes = {'@dependabot[bot]', '@thunderbird-botmobile[bot]', '@weblate'} | ||
| contributors -= excludes |
There was a problem hiding this comment.
Since we're excluding the bots after get_first_contributions(), is it possible we include bots as first contributors?
There was a problem hiding this comment.
Good call, might not be too likely we add a new bot, but if we do we'll want to be able to just add it to the list to exclude it.
| for author, pr in first_contributions.items(): | ||
| print(f"* @{author} made their first contribution in {pr}", file=f) | ||
|
|
||
| changelog = f"https://github.com/thunderbird/thunderbird-android/compare/{older}...{changelog_newer}" |
There was a problem hiding this comment.
nit: hardcoded repo instead of {repo}.
There was a problem hiding this comment.
Yeah, that's cleaner. If we want to fully generalize still can. No need to pass around a parameter that will never change
kryoseu
left a comment
There was a problem hiding this comment.
Added a few comments @stephenking314. None of those issues seem blocking, just some improvements worth noting.
c387729 to
ab78f5a
Compare
Generate contributor list and compare url for github release notes. The goal of this change is to fully automate the generation of github releases removing an error prone, tedious, manual step. Additionally this includes a minor readability update for the render notes script.
ab78f5a to
3fa284c
Compare
Contribution Summary
Generate contributor list and compare url for github release notes.
The goal of this change is to fully automate the generation of github release notes removing an error prone, tedious, manual step.
Additionally this includes a minor readability update for the render notes script.
Pipeline runs performed in fork repo. Note, there was no attempt to fully model the shippable builds pipeline in the private repo since this pipeline uses secrets for various task, and completion of these tasks was not necessary to exercise the desired code paths. See Release Bumps:Append Contributors for the important bits.
modeling a full release
modeling a beta release
AI Disclosure
Select one of the following (mandatory)
Contribution Checklist
gradlew spotlessCheckto check andgradlew spotlessApplyto format your source code; will be checked by CI).gradlew testDebugUnitTest; will be checked by CI).