kotlin: github action doesn't work

This is my action: (I believe only the last part is relevant, from name: Danger)

jobs:
  detekt_job:
    runs-on: ubuntu-latest
    name: GitHub Action for Maven
    steps:
      - uses: actions/checkout@v1
      - name: set environment variables
        uses: allenevans/set-env@v1.0.0
        with:
          ENVIRONMENT: 'dev'
      - uses: actions/checkout@master
      - name: Setup java
        uses: actions/setup-java@v1
        with:
          java-version: 8
      - name: Diffset
        id: diffset
        uses: softprops/diffset@v1
        env:
         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - run: |
          mvn install -pl DetektExtensions
          mvn detekt:check
      - name: Danger
        uses: danger/kotlin@master
        with:
          args: "--id DangerKotlinAction"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

I get the following error:

com.squareup.moshi.JsonDataException: Required value 'issue' missing at $.danger.github
	at com.squareup.moshi.kotlin.reflect.KotlinJsonAdapter.fromJson(KotlinJsonAdapter.kt:96)
	at com.squareup.moshi.JsonAdapter$2.fromJson(JsonAdapter.java:137)
	at com.squareup.moshi.kotlin.reflect.KotlinJsonAdapter.fromJson(KotlinJsonAdapter.kt:83)
	at com.squareup.moshi.JsonAdapter$2.fromJson(JsonAdapter.java:137)
	at com.squareup.moshi.kotlin.reflect.KotlinJsonAdapter.fromJson(KotlinJsonAdapter.kt:83)
	at com.squareup.moshi.JsonAdapter$2.fromJson(JsonAdapter.java:137)
	at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:41)
	at systems.danger.kotlin.DangerRunner.<init>(DangerRunner.kt:125)
	at systems.danger.kotlin.DangerRunnerKt.Danger(DangerRunner.kt:238)
	at Dangerfile_df.<init>(Dangerfile.df.kts:14)
Uncaught Kotlin exception: kotlin.Exception: Command kotlinc -script-templates systems.danger.kts.DangerFileScript -cp /usr/local/lib/danger/danger-kotlin.jar -script Dangerfile.df.kts /tmp/danger-dsl.json danger_out.json exited with code 768

        at kfun:systems.danger.cmd.Cmd.exec() (0x21c739)
        at kfun:systems.danger.cmd.dangerfile.DangerFile.execute(kotlin.String;kotlin.String) (0x21d227)
        at kfun:systems.danger.DangerKotlin.run() (0x21c0e6)
        at Init_and_run_start (0x21f472)
        at __libc_start_main (0x7f42070f6b97)

        at  (0x20f029)
        at  ((nil))

My Danger file:

import org.w3c.dom.Document
import org.w3c.dom.Element
import systems.danger.kotlin.Danger
import systems.danger.kotlin.warn
import java.io.File
import javax.xml.parsers.DocumentBuilderFactory

val danger = Danger(args)

I’ve tried danger/kotlin@master, and I’ve tried danger/kotlin@0.5.1 - same error

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Also I wonder if is related to this https://github.com/danger/danger-js/issues/1042

could you try only on pull-request and remove temporarily on push? because danger is made to work on pull requests only… should check your code before merging something, in a pull-request, not when you push a branch…