danger: Danger fails with "Cannot find a merge base between danger_base and danger_head"
Report
What did you do?
I’m running danger on Travis CI from a pull request.
What did you expect to happen?
Danger shouldn’t crash.
What happened instead?
There is no comment on a PR and in the travis log I see the following error:
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 5 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
From https://github.com/php-coder/mystamps
* [new tag] 0.1 -> 0.1
* [new tag] 0.1.1 -> 0.1.1
* [new tag] 0.1.2 -> 0.1.2
* [new tag] 0.1.3 -> 0.1.3
* [new tag] 0.2 -> 0.2
* [new tag] 0.3 -> 0.3
/home/travis/.rvm/gems/ruby-2.2.5/gems/danger-4.3.2/lib/danger/scm_source/git_repo.rb:77:in `find_merge_base': Cannot find a merge base between danger_base and danger_head. (RuntimeError)
from /home/travis/.rvm/gems/ruby-2.2.5/gems/danger-4.3.2/lib/danger/scm_source/git_repo.rb:16:in `diff_for_folder'
from /home/travis/.rvm/gems/ruby-2.2.5/gems/danger-4.3.2/lib/danger/danger_core/dangerfile.rb:259:in `setup_for_running'
from /home/travis/.rvm/gems/ruby-2.2.5/gems/danger-4.3.2/lib/danger/danger_core/dangerfile.rb:269:in `run'
from /home/travis/.rvm/gems/ruby-2.2.5/gems/danger-4.3.2/lib/danger/danger_core/executor.rb:27:in `run'
from /home/travis/.rvm/gems/ruby-2.2.5/gems/danger-4.3.2/lib/danger/commands/runner.rb:66:in `run'
from /home/travis/.rvm/gems/ruby-2.2.5/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
from /home/travis/.rvm/gems/ruby-2.2.5/gems/danger-4.3.2/bin/danger:5:in `<top (required)>'
from /home/travis/.rvm/gems/ruby-2.2.5/bin/danger:22:in `load'
from /home/travis/.rvm/gems/ruby-2.2.5/bin/danger:22:in `<main>'
from /home/travis/.rvm/gems/ruby-2.2.5/bin/ruby_executable_hooks:15:in `eval'
from /home/travis/.rvm/gems/ruby-2.2.5/bin/ruby_executable_hooks:15:in `<main>'
Your Environment
- Which CI are you running on? Travis CI
- Are you running the latest version of Danger? yes
- What is your Dangerfile? It’s here but error doesn’t relate to my configuration
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 22 (8 by maintainers)
Commits related to this issue
- .travis.yml: use danger 4.3.1 to fix "Cannot find a merge base between danger_base and danger_head" error. Details: https://github.com/danger/danger/issues/768 — committed to php-coder/mystamps by php-coder 7 years ago
- .travis.yml: use danger 4.3.1 to fix "Cannot find a merge base between danger_base and danger_head" error. Details: https://github.com/danger/danger/issues/768 — committed to bodom91/mystamps by php-coder 7 years ago
Just dropping a breadcrumb: we were doing shallow clones on CI for PR builds and once the # of commits on that PR surpassed that depth, it started failing with this error
I think I forgot to comment on an update.
I’m pretty sure that what @rob-keepsafe said worked. We had shallow clone of
depth 1, and once it was changed to shallow clone ofdepth 100it has worked since. The 100 is just a random number to maximize the chance of this issue not happening.