How to Quickly Check Contents of Pull Requests Before Merging with on Windows with GitHub CLI
The aim of this page📝 is to share a little PowerShell wrapper around GitHub CLI I am using daily
The wrapper does 3 steps within a single command:
- Lists the description of a Pull Request
- Prints out the actual changes that were done
- Prompts of the actual merge should be done
I am using this as a trust but verify measure when performing releases/rollouts/deployments and I am given a particular Pull Request ID from developers. The prereq of course is that the GitHub CLI is up and running on your machine.
1. NOTES
- Add this to your
$profile
function mpr($pr_number) {
$pr_number | % {
Write-Host "—— THE DWARVES ARE CHECKING A PR DIFFs ——" -ForegroundColor Darkblue -BackgroundColor DarkYellow
Write-Host "—— VIEW ——" -ForegroundColor DarkCyan
gh pr view $_
Pause
Write-Host "—— DIFFs ——" -ForegroundColor DarkCyan
gh pr diff $_
Pause
Write-Host "—— MERGE ——" -ForegroundColor DarkCyan
gh pr merge $_
}
}
- Navigate to the repo in terminal
- run
mpr <PR#>