danger / danger/kotlin

Bug: git.diff is not populated in CI on Github Actions

Open
#320 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Kotlin
Stars
542
Forks
48
PR merge metrics
No merged PRs in 30d

Description

When trying to write logic / rules around `git.diff`, the action is hanging and this debugging / warning i added never seems to get hit.

```
onGitHub {
// Debug: Check if diff is available
val diffContent = git.diff
warn("DEBUG: Diff is ${if (diffContent.isNullOrEmpty()) "empty/null" else "available (${diffContent.length} chars)"}")
}
```

I am running in CI on Github Actions via this yml.

```
name: Danger

on:
pull_request:
types: [ synchronize, opened, reopened, edited ]

jobs:
danger-kotlin:
runs-on: ubuntu-latest
name: "Run Danger"
steps:
- name: create app token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.DANGER_APP_ID }}
private-key: ${{ secrets.DANGER_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Danger
uses: danger/kotlin@1.3.3
with:
dangerfile: danger/Dangerfile.df.kts
args: --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DANGER_GITHUB_API_TOKEN: ${{ steps.app-token.outputs.token }}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with danger/Dangerfile.df.kts and the supplied GitHub Actions workflow, especially actions/checkout@v4 with fetch-depth: 0 and the danger/kotlin@1.3.3 entry point. Reproduce with --verbose and inspect the onGitHub block around git.diff. Done means the action no longer hangs there and git.diff is populated or its unavailable state is handled consistently in CI.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github-actions, kotlin
Domain
ci-cd, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.