Skip to content

Commit

Permalink
Moving the GITHUB_WORKFLOW check before actually getting the userInfo
Browse files Browse the repository at this point in the history
Because on Github Actions runs, the default secrets.GITHUB_TOKEN doesn't have
user privileges and the workflow fails with a 403
  • Loading branch information
stodirascu committed Nov 11, 2022
1 parent 639898f commit beb7f41
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions source/platforms/github/GitHubAPI.ts
Expand Up @@ -130,11 +130,6 @@ export class GitHubAPI {
return parseInt(perilID)
}

const info = await this.getUserInfo()
if (info.id) {
return info.id
}

const useGitHubActionsID = process.env["GITHUB_WORKFLOW"]
if (useGitHubActionsID) {
// This is the user.id of the github-actions app (https://github.com/apps/github-actions)
Expand All @@ -143,6 +138,11 @@ export class GitHubAPI {
return 41898282
}

const info = await this.getUserInfo()
if (info.id) {
return info.id
}

return undefined
}

Expand Down

0 comments on commit beb7f41

Please sign in to comment.