Skip to content
Samad Yar Khan edited this page Jul 23, 2022 · 2 revisions

GitHub Search Integration

  • GitHub Search enables users to search issue and pull request on GitHub.
  • Search Results can be filtered based on different filters : Repository, Authors, Labels etc.
  • Users can share selected search result to Rocket.Chat rooms.
  • Users can view the code changes of any Pull Request Search Results.
  • We fetch the search results using the GitHub Search API.
  • Search Query are formed according to GitHub search query documentation.

User Flow

Search Query

Users can enter the /github search slash command to trigger the GithubSearchModal. Here the user will be prompted to enter different fields as shown. Search can be filtered based upon the following parameters :

  • Repository
  • Authtors
  • Labels
  • Resource State
  • Milestones

This is the application workflow :

  • Once the user click on Search we will enter the executeViewSumbmitHandler case for GitHubSearchModal.
  • Here a the search query inputs will be parsed and will be passed as input to the githubSearchIssuesPulls() method from GitHubSDK.
  • githubSearchIssuesPulls() will form a search query based on the input parameters and will use the GitHub Search API to fetch relevant results.
  • The Results will returned to executeViewSumbmitHandler and it will trigger the githubSearchResultModal and display the results.

search

Sharing Search Results

  • A given search result can be sent to the current Rocket.Chat Room but clicking on Share.
  • When Share is clicked, the ExecuteBlockActionHandler is triggered and it gets the shareable message in the contextInteractionData value.
  • Here we use the sendMessage helper function from the lib/helperMessage.ts to send this to the Rocket.Chat Room.

share

View Pull Request Result Code Changes

  • All pull request search results will have a View Changes button.
  • When user clicks on ViewChanges, ExecuteBlockActionHandler will parse the contextInteractionData to fetch repository name and pull number.
  • These will be passed to pullDetailsModal , where the changed files will be listed.
  • When user click on View File/View Changes, ExecuteBlockActionHandler will be called again and the file code/file changes will be fetched and displayed in fileCodeModal

file changes

Clone this wiki locally