Skip to content

Commit

Permalink
fix: add error message to issue creation 410
Browse files Browse the repository at this point in the history
  • Loading branch information
prototypicalpro committed Sep 3, 2020
1 parent 3763476 commit 9eadd13
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ function createRepolinterIssue(client, options) {
catch (e) {
if (e.status === 404)
throw new Error('Creating an issue returned a 404! Did you setup a token with the correct permissions?');
else if (e.status === 410)
throw new Error("Creating an issue returned status 410. This is probably due to a scope limitation of your PAT, check that you set the correct permissions (note that GITHUB_TOKEN cannot write repositories other than it's own)");
else if (e.status === 410)
throw new Error('Creating an issue returned 410, are issues enabled on the repository?');
else
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/createorUpdateIssue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ export async function createRepolinterIssue(
throw new Error(
'Creating an issue returned a 404! Did you setup a token with the correct permissions?'
)
else if (e.status === 410)
throw new Error(
"Creating an issue returned status 410. This is probably due to a scope limitation of your PAT, check that you set the correct permissions (note that GITHUB_TOKEN cannot write repositories other than it's own)"
)
else if ((e as RequestError).status === 410)
throw new Error(
'Creating an issue returned 410, are issues enabled on the repository?'
Expand Down

0 comments on commit 9eadd13

Please sign in to comment.