Class: Danger::DangerfileGitHubPlugin
- Defined in:
- lib/danger/danger_core/plugins/dangerfile_github_plugin.rb
PR Metadata collapse
-
#pr_author ⇒ Object
The username of the author of the Pull Request.
-
#pr_body ⇒ Object
The body text of the Pull Request.
-
#pr_labels ⇒ String
The labels assigned to the Pull Request.
-
#pr_title ⇒ Object
The title of the Pull Request.
PR Commit Metadata collapse
-
#base_commit ⇒ Object
The base commit to which the PR is going to be merged as a parent.
-
#branch_for_merge ⇒ Object
The branch to which the PR is going to be merged into.
-
#head_commit ⇒ Object
The head commit to which the PR is requesting to be merged from.
Instance Method Summary collapse
-
#initialize(dangerfile) ⇒ DangerfileGitHubPlugin
constructor
A new instance of DangerfileGitHubPlugin.
Methods inherited from Plugin
all_plugins, inherited, instance_name, #method_missing
Constructor Details
#initialize(dangerfile) ⇒ DangerfileGitHubPlugin
Returns a new instance of DangerfileGitHubPlugin.
5 6 7 8 9 10 |
# File 'lib/danger/danger_core/plugins/dangerfile_github_plugin.rb', line 5 def initialize(dangerfile) super(dangerfile) return nil unless dangerfile.env.request_source.class == Danger::RequestSources::GitHub @github = dangerfile.env.request_source end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Danger::Plugin
Instance Method Details
#base_commit ⇒ Object
The base commit to which the PR is going to be merged as a parent
56 57 58 |
# File 'lib/danger/danger_core/plugins/dangerfile_github_plugin.rb', line 56 def base_commit @github.pr_json[:base][:sha] end |
#branch_for_merge ⇒ Object
The branch to which the PR is going to be merged into
48 49 50 |
# File 'lib/danger/danger_core/plugins/dangerfile_github_plugin.rb', line 48 def branch_for_merge @github.pr_json[:base][:ref] end |
#head_commit ⇒ Object
The head commit to which the PR is requesting to be merged from
64 65 66 |
# File 'lib/danger/danger_core/plugins/dangerfile_github_plugin.rb', line 64 def head_commit @github.pr_json[:head][:sha] end |
#pr_author ⇒ Object
The username of the author of the Pull Request
32 33 34 |
# File 'lib/danger/danger_core/plugins/dangerfile_github_plugin.rb', line 32 def @github.pr_json[:user][:login].to_s end |
#pr_body ⇒ Object
The body text of the Pull Request
24 25 26 |
# File 'lib/danger/danger_core/plugins/dangerfile_github_plugin.rb', line 24 def pr_body @github.pr_json[:body].to_s end |
#pr_labels ⇒ String
The labels assigned to the Pull Request
40 41 42 |
# File 'lib/danger/danger_core/plugins/dangerfile_github_plugin.rb', line 40 def pr_labels @github.issue_json[:labels].map { |l| l[:name] } end |
#pr_title ⇒ Object
The title of the Pull Request
16 17 18 |
# File 'lib/danger/danger_core/plugins/dangerfile_github_plugin.rb', line 16 def pr_title @github.pr_json[:title].to_s end |