-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<img width="906" alt="image" src="https://github.com/alwaysmeticulous/report-diffs-action/assets/793481/d37ec9c9-3727-4ebf-aeca-00e634976ecf"> <img width="1454" alt="image" src="https://github.com/alwaysmeticulous/report-diffs-action/assets/793481/33bb5f90-d88c-4fd4-931f-7d72639b6a8a">
- Loading branch information
Showing
12 changed files
with
246 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { DOCS_URL } from "./constants"; | ||
|
||
export const isGithubPermissionsError = ( | ||
error: MaybeOctokitRequestError | unknown | ||
): boolean => { | ||
const message = getErrorMessage(error); | ||
return ( | ||
message.toLowerCase().includes("resource not accessible by integration") || | ||
(error as MaybeOctokitRequestError)?.status === 403 | ||
); | ||
}; | ||
|
||
export const getErrorMessage = (error: unknown) => { | ||
const message = (error as MaybeOctokitRequestError)?.message ?? ""; | ||
return typeof message === "string" ? message : ""; | ||
}; | ||
|
||
// Octokit returns RequestErrors, which have a message and a code | ||
// But we can't make any strong assumptions, so we type it on the safe side | ||
// https://github.com/octokit/request-error.js/blob/372097e9b16f70d4ad75089003dc9154e304faa7/src/index.ts#L16 | ||
type MaybeOctokitRequestError = | ||
| { | ||
message?: string | unknown; | ||
status?: number | unknown; | ||
} | ||
| null | ||
| undefined; | ||
|
||
export const DEFAULT_FAILED_OCTOKIT_REQUEST_MESSAGE = `Please check www.githubstatus.com, and that you have setup the action correctly, including with the correct permissions: see ${DOCS_URL} for the correct setup.`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
2d18f3a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
report-diffs-action – ./
report-diffs-action-meticulous.vercel.app
report-diffs-action.vercel.app
report-diffs-action-git-main-meticulous.vercel.app