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

Tear it all apart... #197

Merged
merged 15 commits into from
Jul 17, 2024
Merged

Tear it all apart... #197

merged 15 commits into from
Jul 17, 2024

Conversation

sleberknight
Copy link
Member

@sleberknight sleberknight commented Jul 16, 2024

The high-level summary is that this replaces all the git log parsing for issue numbers with calls to the Search and Commit endpoints in the GitHub REST API. The Search endpoints are used to find the issues and PRs linked to a specific milestone. The Commit endpoint is used to find the unique commit authors (as opposed to the creator and/or assignees of issues and PRs). So, a lot of code was outright removed, a lot was replaced, and a lot of things were renamed to better align with that they are. Hopefully, this makes things more clear. Also, while adding and replacing code, tests have been added so the overall coverage is now closes to 90%. The only major thing not tested is in the App class.

Major renames and refactorings:

  • ChangelogGeneratorMain renamed to App
  • GenerateChangelog renamed to ChangelogGenerator
  • Merge RepoHostConfig and RepoConfig, with the final result in RepoConfig
  • GitHubListFetcher renamed to GitHubPagingHelper, and refactored as a helper class for pagination (not specific to issues)
  • Rename things that have GitHub in their name to have a capital H (i.e., GitHub not Github)

Additions/Changes:

  • Add GitHubCategoryFinder as a utility to find a category given a list of labels; this was extracted from GithubTicketFetcher, which has been deleted
  • Add GitHubChange to represent the information from an issue or PR that we need for the change log
  • Make outputFile in ChangelogConfig have a null default value
  • Tests and a bunch of test resources (JSON sample responses)
  • Enhance ConfigHelpers#externalConfig to use a kiwi LoggingDeserializationProblemHandler to log deserialization errors (for example if there's something unexpected in a YAML config file) at WARN level. There is a TODO to find a better way to report these errors to a user, rather than an ugly log message.
  • Add a milestone function to RepoConfig which returns an explicitly-provided milestone, or else assumes the revision is in format vX.Y.Z and removes the leading "v"
  • Add several handy-dandy extension methods to MapExtensions
  • Update GitHubApi#GitHubResponse#from method to allow for the (odd) possibility of seeing a negative duration for the rate limit reset. Yes, it happened to me which is why I added the code...
  • Change the println in GitHubApi to DEBUG-level logging
  • Add new tests for things that did not have a test, e.g., add AppTest for App

Command line args:

  • Remove working directory ( -w / --working-dir )
  • Remove "alwaysIncludePRsFrom" ( -i / --include-prs-from )
  • Change --milestone-to-close to just --milestone (short arg remains -M)
  • Make previous revision required
  • Remove default from revision (was HEAD) and made it required

Removals:

  • GitCommit
  • GitLogProvider
  • Ticket
  • TicketParser
  • RepoHostConfig (merged into RepoConfig)

Misc:

  • Add MockWebServerExtension JUnit Jupiter extension to start/stop a MockWebServer
  • Update several tests to use MockWebServerExtension
  • Refactored internals of App#main so that we can test it without System.exit being called. Did this by extracting an internal "execute" method which returns an AppResult containing the exit code and the App itself, which allows us to test the argument parsing. App#main calls execute and then calls exitProcess with the AppResult.exitCode

Documentation

  • Update the main README to reflect all the changes to usage
  • Update the documentation in App for the top-level description and several argument
  • Remove the "alwaysIncludePRsFrom" property from the sample kiwi changelog (sample-kiwi-changelog.yml)

Closes #194

@sleberknight sleberknight marked this pull request as draft July 16, 2024 13:12
@sleberknight sleberknight requested a review from chrisrohr July 16, 2024 13:12
@sleberknight sleberknight self-assigned this Jul 16, 2024
@sleberknight sleberknight requested a review from dsingley July 16, 2024 18:27
@sleberknight sleberknight marked this pull request as ready for review July 17, 2024 01:26
Copy link

@sleberknight sleberknight merged commit 7203ad7 into main Jul 17, 2024
5 checks passed
@sleberknight sleberknight deleted the 194-wipe-slate-clean branch July 17, 2024 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Determine the issues and PRs for a release using the GitHub APIs
1 participant