diff --git a/CHANGELOG.md b/CHANGELOG.md index 3837d48d0..9aa888b0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ x - Add the staged flag to `danger local` command - [@soyn] - +- Disable warning in Github Action if using DANGER_GITHUB_API_TOKEN- [@rohit-gohri] - Update `parse-diff` library - [@417-72KI] - Fix repository slug in Jenkins provider - [sandratatarevicova] - Fix Typos across danger-js Repo - [@yohix] @@ -105,7 +105,7 @@ x - Fix Github Actions documentation - [@ravanscafi] - Improve Performance by Caching BitBucket Cloud Commits - [@hellocore] - Add compliment message to comment template on Bitbucket Cloud - [@hellocore] -- Add option to set custom icon in messages - [@rohit-smpx] +- Add option to set custom icon in messages - [@rohit-gohri] # 9.1.0 @@ -1743,7 +1743,7 @@ Not usable for others, only stubs of classes etc. - [@orta] [@peterjgrainger]: https://github.com/peterjgrainger [@randak]: https://github.com/randak [@ravanscafi]: https://github.com/ravanscafi -[@rohit-smpx]: https://github.com/rohit-smpx +[@rohit-gohri]: https://github.com/rohit-gohri [@sajjadzamani]: https://github.com/sajjadzamani [@sebinsua]: https://github.com/sebinsua [@sgtcoolguy]: https://github.com/sgtcoolguy diff --git a/source/platforms/platform.ts b/source/platforms/platform.ts index 1b4d34528..dd3f47652 100644 --- a/source/platforms/platform.ts +++ b/source/platforms/platform.ts @@ -142,8 +142,11 @@ export function getPlatformForEnv(env: Env, source: CISource): Platform { return new GitLab(api) } + // GitHub Platform + const ghToken = env["DANGER_GITHUB_API_TOKEN"] || env["GITHUB_TOKEN"] + // They need to set the token up for GitHub actions to work - if (env["GITHUB_EVENT_NAME"] && !env["GITHUB_TOKEN"]) { + if (env["GITHUB_EVENT_NAME"] && !ghToken) { console.error(`You need to add GITHUB_TOKEN to your Danger action in the workflow: - name: Danger JS @@ -153,8 +156,6 @@ export function getPlatformForEnv(env: Env, source: CISource): Platform { `) } - // GitHub Platform - const ghToken = env["DANGER_GITHUB_API_TOKEN"] || env["GITHUB_TOKEN"] if (ghToken || env["DANGER_PR_PLATFORM"] === GitHub.name) { if (!ghToken) { console.log("You don't have a DANGER_GITHUB_API_TOKEN set up, this is optional, but TBH, you want to do this")