-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem Statement
Build Notes requires mining information from the repository including tags, pull-requests, issues, and git hashes.
Proposed Solution
Getting repository information is provider-specific. Currently the intent is to support GitHub, but Azure DevOps and other providers may be supported later. As such a generic IRepoConnector interface should be defined, and then a GitHub implementation created.
The classes will work with the repository the tool is executing under.
The operations required include:
- Getting the history of tags leading to the current branch
- Get the list of pull request IDs between two tags in the repository (from/to) with either one being blank/null to indicate the start/end of the history
- Get the issue IDs associated with a pull request
- Get an issues title and type (bug, feature, etc.)
- Get a hash for a git tag (with blank/null being the hash of the current repo state)
It would also be beneficial to have a RepoConnectorFactory static class that creates IRepoConnector instances based on determining the type of repository used - possibly by checking for environment variables expected under CI build agents, or by inspecting the origin of the repo.
While the IRepoConnector interface allows for testing down-stream consumers (via dependency injection) a means will also need to exist to test the implementations. One approach may be that all RepoConnector instances have a common base class, and that common base has an overridable Run method which it uses to run CLI commands (git or gh). Then testing would entail overriding that method to inject fake results and ensuring the result-processing works.
Finally a MockRepoConnector may want to be created that produces deterministic output - required for eventual self-validation.
Alternatives Considered
No response
Usage Examples
Benefits
Ability to read repository information.
Priority
High - Blocking my use case
Willingness to Contribute
Yes, I can submit a pull request
Additional Context
It seems almost everything required for the GitHub implementation can be achieved using combinations of the 'git' and 'gh' commands. The implementation can assume both of these tools are installed on the system.
Checklist
- I have searched existing issues to ensure this is not a duplicate
- I have provided a clear description of the feature
- I have explained why this feature would be useful