DangerJS fails in github actions
See original GitHub issueHello! Trying to figure out the best way to run danger via GitHub actions. I have gotten to the point of the action running and finding my dangerfile no problem, but the danger.github
API is coming back null
.
I have seen this happen when I run the danger local
command as well, where the other namespaces (eg danger.git
) are fine, but clearly there is no PR to reference so the danger.github
response being null
makes sense to me.
Here is that config:
workflow "Dangerfile JS Eval" {
on = "pull_request"
resolves = "Danger JS"
}
action "Danger JS" {
uses = "danger/danger-js@master"
secrets = ["GITHUB_TOKEN"]
args = "--dangerfile ./dangerfile.ts"
}
I have also tried just running a typical bash script via github actions (just following the docs, with a Dockerfile
and an entrypoint.sh
). I can run the following script and have the same issue:
#!/bin/sh -l
set -eu
export DANGER_GITHUB_API_TOKEN="$GITHUB_TOKEN"
yarn global add danger
# Run danger
danger --dangerfile="./dangerfile.ts" ci
This yields a null
value for danger.github
as well.
My last attempt was to use the --external-ci-provider "GitHubActions"
and I got this response:
could not load CI provider at GitHubActions due to Error: ENOENT: no such file or directory, stat '/github/workspace/GitHubActions'
Again, I can run the danger pr https://github/path/to/pr
and it runs fine, and that bash script currently works on our CircleCi
.
Any information/links/examples for Github Actions you can provide would be really helpful! If there is someway I can help document/contribute let me know.
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (4 by maintainers)
Top GitHub Comments
For those that come after me. I’ll provide what i got working based on @mattyfresh advice:
<project root>/run-danger/Dockerfile
<project root>/run-danger/entrypoint.sh
<project root>/.github/main.workflow
Hope this helps someone.
I concur that the linked PR fixed my issue!