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
1 min readSep 12, 2022
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#>