Skip to content

Fix tests by using API Key for CI #2255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

TylerLeonhardt
Copy link
Member

PR Summary

Fixes the tests by using an API Key for CI so that we aren't rate limited by GitHub's APIs.

PR Checklist

Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets.
Please mark anything not applicable to this PR NA.

  • PR has a meaningful title
  • Summarized changes
  • PR has tests
  • This PR is ready to merge and is not work in progress
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready

@TylerLeonhardt TylerLeonhardt marked this pull request as ready for review October 25, 2019 14:34
// Fetch the latest PowerShell releases from GitHub.
let releaseJson: any;
if (preview) {
// This gets all releases and the first one is the latest prerelease if
// there is a prerelease version.
releaseJson = (await fetch(PowerShellGitHubPrereleasesUrl)
releaseJson = (await fetch(PowerShellGitHubPrereleasesUrl, requestConfig)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the point of await to obviate the need for then()?

Copy link
Member Author

@TylerLeonhardt TylerLeonhardt Oct 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's either this or double awaiting which I felt was a tad less clear with the extra parens and more verbose than an intermediate variable. I can change it if you'd like.

await (await fetch(PowerShellGitHubReleasesUrl, requestConfig)).json();

// or

const res = await fetch(PowerShellGitHubReleasesUrl, requestConfig);
releaseJson = await res.json();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No no, no need to derail the PR

@TylerLeonhardt
Copy link
Member Author

@rjmholt refactored for better error handling. I ran CI like 5-8 times and green every time.

@TylerLeonhardt TylerLeonhardt merged commit ae72089 into PowerShell:master Oct 28, 2019
@TylerLeonhardt TylerLeonhardt deleted the fix-tests-github-ratelimit branch October 28, 2019 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants