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

  • run get-lastPRurl
  • you get the URL clipped

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
}

--

--

Infrastructure Support Engineer/Technical Writer (snowplow.io) with a passion for Python/writing documentation. More about me: https://pavol.kutaj.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pavol Kutaj

Infrastructure Support Engineer/Technical Writer (snowplow.io) with a passion for Python/writing documentation. More about me: https://pavol.kutaj.com