Skip to content

Commit beb7f41

Browse files
committedNov 11, 2022
Moving the GITHUB_WORKFLOW check before actually getting the userInfo
Because on Github Actions runs, the default secrets.GITHUB_TOKEN doesn't have user privileges and the workflow fails with a 403
1 parent 639898f commit beb7f41

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎source/platforms/github/GitHubAPI.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@ export class GitHubAPI {
130130
return parseInt(perilID)
131131
}
132132

133-
const info = await this.getUserInfo()
134-
if (info.id) {
135-
return info.id
136-
}
137-
138133
const useGitHubActionsID = process.env["GITHUB_WORKFLOW"]
139134
if (useGitHubActionsID) {
140135
// This is the user.id of the github-actions app (https://github.com/apps/github-actions)
@@ -143,6 +138,11 @@ export class GitHubAPI {
143138
return 41898282
144139
}
145140

141+
const info = await this.getUserInfo()
142+
if (info.id) {
143+
return info.id
144+
}
145+
146146
return undefined
147147
}
148148

0 commit comments

Comments
 (0)
Please sign in to comment.