Skip to content

Commit e462d89

Browse files
jdeniauAndarist
andauthored
Add scopes automatically in the GitHub new token link in the printed error message (#1758)
* direct link for github token * Apply suggestion from @Andarist --------- Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
1 parent 503fcaa commit e462d89

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

.changeset/purple-bananas-grow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/get-github-info": minor
3+
---
4+
5+
Add scopes automatically in the GitHub new token link in the printed error message

packages/get-github-info/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const getReleaseLine = async (changeset, type) => {
5252
// ...
5353
```
5454

55-
You'll need to [get a GitHub personal access token](https://github.com/settings/tokens/new) with `read:user` and `repo:status` permissions, and add it to a `.env` file.
55+
You'll need to [get a GitHub personal access token](https://github.com/settings/tokens/new?scopes=read:user,repo:status&description=changesets) with `read:user` and `repo:status` permissions, and add it to a `.env` file.
5656

5757
```bash
5858
GITHUB_TOKEN=token_here

packages/get-github-info/src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ const GHDataLoader = new DataLoader(async (requests: RequestData[]) => {
9090
const { GITHUB_GRAPHQL_URL, GITHUB_SERVER_URL, GITHUB_TOKEN } = readEnv();
9191
if (!GITHUB_TOKEN) {
9292
throw new Error(
93-
`Please create a GitHub personal access token at ${GITHUB_SERVER_URL}/settings/tokens/new with \`read:user\` and \`repo:status\` permissions and add it as the GITHUB_TOKEN environment variable`
93+
`Please create a GitHub personal access token at ${GITHUB_SERVER_URL}/settings/tokens/new?scopes=read:user,repo:status&description=changesets-${new Date()
94+
.toISOString()
95+
.substring(
96+
0,
97+
10
98+
)} with \`read:user\` and \`repo:status\` permissions and add it as the GITHUB_TOKEN environment variable`
9499
);
95100
}
96101
let repos: ReposWithCommitsAndPRsToFetch = {};

0 commit comments

Comments
 (0)