Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined method in pull request finder #1426

Open
mcoe-git opened this issue Feb 7, 2023 · 1 comment
Open

Undefined method in pull request finder #1426

mcoe-git opened this issue Feb 7, 2023 · 1 comment

Comments

@mcoe-git
Copy link

mcoe-git commented Feb 7, 2023

Report

What did you do?

danger pr <Pull_Request>

What did you expect to happen?

Run against danger file

What happened instead?

Running into undefined method, please see stack trace below:

Traceback (most recent call last):
        12: from /Users/xyz/.rbenv/versions/2.7.4/bin/danger:23:in `<main>'
        11: from /Users/xyz/.rbenv/versions/2.7.4/bin/danger:23:in `load'
        10: from /Users/xyz/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/danger-9.2.0/bin/danger:5:in `<top (required)>'
         9: from /Users/xyz/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
         8: from /Users/xyz/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/danger-9.2.0/lib/danger/commands/pr.rb:60:in `run'
         7: from /Users/xyz/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/danger-9.2.0/lib/danger/commands/pr.rb:60:in `new'
         6: from /Users/xyz/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/danger-9.2.0/lib/danger/danger_core/environment_manager.rb:30:in `initialize'
         5: from /Users/xyz/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/danger-9.2.0/lib/danger/danger_core/environment_manager.rb:30:in `new'
         4: from /Users/xyz/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/danger-9.2.0/lib/danger/ci_source/local_git_repo.rb:48:in `initialize'
         3: from /Users/xyz/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/danger-9.2.0/lib/danger/ci_source/local_git_repo.rb:94:in `find_pull_request'
         2: from /Users/xyz/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/danger-9.2.0/lib/danger/ci_source/support/pull_request_finder.rb:18:in `call'
         1: from /Users/xyz/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/danger-9.2.0/lib/danger/ci_source/support/pull_request_finder.rb:51:in `find_pull_request'
/Users/xyz/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/danger-9.2.0/lib/danger/ci_source/support/pull_request_finder.rb:75:in `generate_remote_pull_request': undefined method `[]' for nil:NilClass (NoMethodError)

Your Environment

  • Which CI are you running on? - Fails on both local and on TeamCity
  • Are you running the latest version of Danger? Yes 9.2.0
  • What is your Dangerfile?
commit_message_types = ["feature", "bugfix", "chore", "lint"]
git.commits.each do | commit |

    # All Commits should start with feat/chore/bugfix/lint.
    if commit.message.start_with?(*commit_message_types) == false 
        fail "Commit template not followed. #{commit.message}"
    end

    # Should be more than 50 characters.
    if commit.message.length < 50
        fail "Please include a meaningful commit message. #{commit.message}"
    end

end
@manicmaniac
Copy link
Member

📝
Crashed in this line:

remote_pull_request[:fromRef][:latestCommit],

It seems that .fromRef.latestCommit still exists in API specification.
https://confluence.atlassian.com/bitbucketserver/event-payload-938025882.html

@mcoe-git
How did you run danger pr <Pull_Request>?
I think the <Pull_Request> part should be an absolute URL to the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants