Get URL Of The Last Pull Request With Powershell

The aim of this playbook🏁 is to show obtaining the URL of the last pull request with PowerShell and GitHub CLI.

1. steps

  • navigate to the repo

2. CODE

function get-lastPRurl {
$prn = gh pr list --state all --limit 1 --json number | ConvertFrom-Json
$prurl = gh pr view $prn.number --json url | ConvertFrom-Json
$prurl.url | clip
Write-Host $prurl.url clipped -Foregroundcolor DarkCyan
}