Git Approvers Hover Extension
Shows the PR approvers when hovering over lines of code.
2024
Role
Lab
Tech
Javascript Typescript
Agancy
Telavox
Git Approvers Hover Extension
Overview
Git Approvers Hover is a Visual Studio Code extension that shows the PR approvers when hovering over lines of code. It works by leveraging git blame to identify the commit and then fetches the related pull request and its approvals from GitHub.Features
- Hover over a line of code to see the list of users who approved the corresponding GitHub Pull Request.
- Supports projects with Git repositories linked to GitHub.
Installation
- Download the .vsix file for the extension.
- Open Visual Studio Code.
- Go to the Extensions view by clicking the Extensions icon in the Activity Bar or pressing Ctrl+Shift+X.
- Click on the three-dot menu (...) in the top-right corner of the Extensions view.
- Select Install from VSIX....
- Browse to and select the downloaded .vsix file.
Usage
- Open a workspace that is part of a Git repository.
- Hover over any line of code in a tracked file.
- If the line corresponds to a commit with an associated GitHub pull request, the extension will display the list of approvers for that PR.
Requirements
- The workspace must be a Git repository.
- The repository must be hosted on GitHub.
- A GitHub API token with appropriate permissions should be set as an environment variable (GITHUB_TOKEN) or configured in the extension.
Setup GitHub API Token
The extension requires a GitHub API token to fetch pull request information. You can set the token as an environment variable:-
Go to GitHub’s Personal Access Token page and generate a new token with the necessary permissions (e.g., repo).
-
Set the token as an environment variable:
export GITHUB_TOKEN=your-token-here