Add GitHub commit URL detection to show commit info instead of repo info#213
Open
mvineetmenon wants to merge 1 commit intojohnmaguire:masterfrom
Open
Add GitHub commit URL detection to show commit info instead of repo info#213mvineetmenon wants to merge 1 commit intojohnmaguire:masterfrom
mvineetmenon wants to merge 1 commit intojohnmaguire:masterfrom
Conversation
- Add COMMIT_URL_REGEX to match GitHub commit URLs - Modify get_repo_info to prioritize commit URLs over repo/issue URLs - Add _show_commit method to display commit subject and add/delete stats - Update tests to cover commit URL detection and display functionality
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #213 +/- ##
=======================================
Coverage 88.77% 88.77%
=======================================
Files 8 8
Lines 1042 1042
=======================================
Hits 925 925
Misses 117 117 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Owner
|
Hey this looks really great, thank you for this! I will test it out soon and merge it as long as everything is working correctly.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This change adds support for detecting GitHub commit URLs in the Cardinal IRC bot's GitHub plugin. When a commit URL is posted in a channel, the bot will now display the commit subject and add/delete statistics instead of the repository information.
Changes Made:
COMMIT_URL_REGEXto match GitHub commit URLs with the patternhttps://github.com/user/repo/commit/shaget_repo_infoevent handler to check for commit URLs first, prioritizing them over issue/repo URLs_show_commitmethod that fetches commit data from the GitHub API and formats it assha: subject (+additions -deletions)The implementation maintains backward compatibility - repo and issue URLs continue to work as before, but commit URLs now get special handling to show more relevant commit-specific information.
Test Plan
COMMIT_URL_REGEXpattern matching with various GitHub URL formatsget_repo_infomethod with commit URLs, including cases with and without commit statsContribution Checklist
CONTRIBUTORSfile if desired (optional).