Skip to content

Commit

Permalink
feat(policies): Use github access token when requesting releases (#6912)
Browse files Browse the repository at this point in the history
* feat(policies): Use github access token when requesting releases

If the environment variable `GITHUB_TOKEN` is defined, append `?access_token=<GITHUB_TOKEN>` when requesting yarn releases from GitHub.

Closes #6905

* fix lint

* Update CHANGELOG.md
  • Loading branch information
billyvg authored and arcanis committed Jan 14, 2019
1 parent 6c41eb1 commit 94f83d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,10 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa
- Fixes PnP detection with workspaces (`installConfig` is now read at the top-level)

[#6878](https://github.com/yarnpkg/yarn/pull/6878) - [**Maël Nison**](https://twitter.com/arcanis)

- Adds support for `GITHUB_TOKEN` in `yarn policies set-version`

[#6912](https://github.com/yarnpkg/yarn/pull/6912) - [**Billy Vong**](https://github.com/billyvg)

## 1.13.0

Expand Down
4 changes: 3 additions & 1 deletion src/cli/commands/policies.js
Expand Up @@ -47,8 +47,10 @@ async function fetchReleases(
config: Config,
{includePrereleases = false}: FetchReleasesOptions = {},
): Promise<Array<Release>> {
const token = process.env.GITHUB_TOKEN;
const tokenUrlParameter = token ? `?access_token=${token}` : '';
const request: Array<Release> = await config.requestManager.request({
url: `https://api.github.com/repos/yarnpkg/yarn/releases`,
url: `https://api.github.com/repos/yarnpkg/yarn/releases${tokenUrlParameter}`,
json: true,
});

Expand Down

0 comments on commit 94f83d6

Please sign in to comment.