Skip to content

Instantly share code, notes, and snippets.

@IlyaFinkelshteyn
Created March 28, 2018 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IlyaFinkelshteyn/6c202388e2afe53a520c5a08ec15a688 to your computer and use it in GitHub Desktop.
Save IlyaFinkelshteyn/6c202388e2afe53a520c5a08ec15a688 to your computer and use it in GitHub Desktop.
#replace
$token = ""
$env:gh_user = ""
$env:gh_repo = ""
$env:tag_to_find = ""
#replace
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
$tags = Invoke-RestMethod -Uri "https://api.github.com/repos/$env:gh_user/$env:gh_repo/git/refs/tags" -Headers $headers -Method GET
($tags | ? {$_.ref.Substring($tags[0].ref.LastIndexOf("/") + 1) -eq $env:tag_to_find}).object.sha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment