Skip to content

Commit

Permalink
Merge pull request #6 from rurku/fix_github_api_rate_limit_from_travis
Browse files Browse the repository at this point in the history
 Authenticate github api request to get release id
  • Loading branch information
rurku authored Apr 27, 2018
2 parents 4758d5e + 04ffac6 commit 0c39cff
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tools/after_deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ if ($env:TRAVIS_TAG -NotLike '*-*')
{
"It's not a prerelease tag. Mark release as not prerelease."
"Getting release ID for tag $($env:TRAVIS_TAG)"
$response = Invoke-WebRequest -Uri "https://api.github.com/repos/$($env:TRAVIS_REPO_SLUG)/releases/tags/$($env:TRAVIS_TAG)" | ConvertFrom-Json
$response = Invoke-WebRequest `
-Uri "https://api.github.com/repos/$($env:TRAVIS_REPO_SLUG)/releases/tags/$($env:TRAVIS_TAG)" `
-Headers @{Authorization="token $($env:GITHUB_RELEASE_TOKEN)"} `
| ConvertFrom-Json
"Setting release as not prerelease"
$patchResponse = Invoke-WebRequest `
-Uri "https://api.github.com/repos/$($env:TRAVIS_REPO_SLUG)/releases/$($response.id)" `
-Method PATCH -ContentType 'application/json' `
-Headers @{Authorization="token $($env:GITHUB_RELEASE_TOKEN)"} `
-Body '{"prerelease": false}'
-Uri "https://api.github.com/repos/$($env:TRAVIS_REPO_SLUG)/releases/$($response.id)" `
-Method PATCH -ContentType 'application/json' `
-Headers @{Authorization="token $($env:GITHUB_RELEASE_TOKEN)"} `
-Body '{"prerelease": false}'
"Status code: $($patchResponse.StatusCode)"
}

0 comments on commit 0c39cff

Please sign in to comment.