refactor(github): consolidate types and contents code #576
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #543
Applied changes based on Issue #543.
I’ve refactored src/github/types.ts and updated its usages in src/github/contents.ts to improve modularity, consistency, and documentation, while preserving all existing functionality:
1. Extracted & documented reusable payload types
GitHubComment
– a basic issue/PR comment typeGitHubPullRequestMinimal
– a minimal PR shape for review‐comment eventsGitHubReviewComment
– extracted the inline shape used by review comments【F:src/github/types.ts†L61-L86】
2. Updated the review‐comment event to use the new types
【F:src/github/types.ts†L88-L94】
3. Renamed “Github…” types to “GitHub…” for naming consistency
GithubComment
→GitHubComment
GithubContentsData
→GitHubContentsData
【F:src/github/types.ts†L56-L60】【F:src/github/types.ts†L98-L102】
4. Updated all references in src/github/contents.ts to the renamed
GitHubContentsData
【F:src/github/contents.ts†L6-L7】【F:src/github/contents.ts†L47-L49】【F:src/github/contents.ts†L65-L70】【F:src/github/contents.ts†L124-L129】【F:src/github/contents.ts†L186-L191】
These changes improve modularity (by extracting reusable type pieces), enforce a consistent naming convention (GitHub vs Github), and add JSDoc for clarity, without altering any runtime behavior. Let me know if you’d like any further tweaks!