检查失败时危险不会发出警告

Danger does not warn when check should fail

我正在使用 Danger 检查 PR。 我的危险文件包含:

# 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

PR 包含更改:

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

当我调用 danger local 时,我没有看到预期的警告

我找到了解决办法。如果我使用 danger pr <url> 而不是 danger local,那么一切正常。 danger local 由于我不知道的原因指向了错误的 PR。