question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DangerJS fails in github actions

See original GitHub issue

Hello! 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:closed
  • Created 5 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
mcpengellycommented, Jun 4, 2019

For those that come after me. I’ll provide what i got working based on @mattyfresh advice:

<project root>/run-danger/Dockerfile

FROM node:8

LABEL "com.github.actions.name"="dangerjs"
LABEL "com.github.actions.description"="run dangerjs pr checks"
LABEL "com.github.actions.icon"="mic"
LABEL "com.github.actions.color"="purple"

ADD entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

<project root>/run-danger/entrypoint.sh

#!/bin/sh -l

# Install danger cli on the machine
yarn global add danger

# install needed dependencies
yarn

# Run danger
danger --dangerfile "./dangerfile.js" ci

<project root>/.github/main.workflow

workflow "Dangerfile JS Eval" {
  on = "pull_request"
  resolves = "Danger JS"
}
action "Danger JS" {
  uses = "./run-danger/"
  secrets = ["GITHUB_TOKEN"]
}

Hope this helps someone.

2reactions
fbarthocommented, Dec 11, 2018

I concur that the linked PR fixed my issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Github Actions: Resource Not Available to Integration
In DangerJS lately, I've been getting 403 errors when it's trying to fetch the previous comments, so it's constantly duplicating the danger ...
Read more >
Github Action fails when PR comes from forked repo #918
Problem Danger crashes when I accept a PR from the fork: https://github.com/sobolevn/itmo-2019/pull/18/checks?check_run_id=222332195 But, ...
Read more >
Danger regularly runs out of memory in GitHub Actions #985
Hi there, I'm running Danger for a project using GitHub Actions. ... using danger-js - is it possibly the work your doing in...
Read more >
[BUG] GitHub action integration currently broken · Issue #1042 ...
Describe the bug Between the 16th of May and the 13th of May, I noticed that running Danger via GitHub Actions didn't work...
Read more >
danger-js/GitHubActions.ts at main
Stop saying "you forgot to …" in code review. Contribute to danger/danger-js development by creating an account on GitHub.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found