Skip to content

Commit

Permalink
Merge pull request #1010 from rohit-gohri/fix-github-warning
Browse files Browse the repository at this point in the history
Don't warn if github token is available in non action format
  • Loading branch information
rohit-gohri committed Mar 5, 2020
2 parents bb55ac0 + 79687d5 commit 5ad5fd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ x
<!-- Your comment below this -->

- 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]
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions source/platforms/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down

0 comments on commit 5ad5fd9

Please sign in to comment.