Search code examples
gitpull-requestdanger

Danger does not warn when check should fail


I'm using Danger to check the PRs. My Dangerfile contains:

# Alert if we are pointing to a debug SDK version
if git.modified_files.include?("tutorials/sdk-refapp/build.gradle")
  diff = git.diff_for_file("tutorials/sdk-refapp/build.gradle")
  fail("Please ensure you are not pointing to a debug SDK version in the sdk-refapp after QA approval", sticky: true) if (diff && diff.patch.include?('-debug'))
end

The PR contains the change:

-def SK_SDK_VERSION = ""
-
+def version = ""
+def SK_SDK_VERSION = "$version-debug"

when I call danger local I don't see the warning I'm expecting


Solution

  • I've found a solution. If instead of danger local I use danger pr <url> then everything works. danger local was pointing to the wrong PR for a reason I don't know.