Quantcast
Viewing latest article 5
Browse Latest Browse All 27

PowerShell Snippets: Get One Value from GitHub Json

Image may be NSFW.
Clik here to view.
PowerShell
This post is part of the series on PowerShell Snippets.

While looking into uploading a release asset to a GitHub release, I discovered that to do this I needed the internal numeric id for a release and not just the id I’d given it. The element I needed from the GitHub json was id which can be retrieved using the below PowerShell which executes curl and then selects a single element:


$ghAuthorizationToken = "ghp_authorizationtoken"

$ghUser="username"
$ghRepo="repositoryname"
$ghTag="v1.4.2"

$URL= "https://api.github.com/repos/$ghUser/$ghRepo/releases/tags/$ghTag"

$Json=(curl.exe $URL)|ConvertFrom-json

$id=$Json| Select id

Read original post PowerShell Snippets: Get One Value from GitHub Json at azurecurve|Ramblings of an IT Professional


Viewing latest article 5
Browse Latest Browse All 27

Trending Articles