Sha256: e853f10ccbff34873806d5a48b1dddd3e534e2e0aa2a1b93939c33b402419a43
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 KB
Contents
require 'danger/plugin_support/plugin' module Danger class DangerfileGitHubPlugin < Plugin def initialize(dangerfile) super(dangerfile) return nil unless dangerfile.env.request_source.class == Danger::RequestSources::GitHub @github = dangerfile.env.request_source end # @!group PR Metadata # The title of the Pull Request # @return String # def pr_title @github.pr_json[:title].to_s end # @!group PR Metadata # The body text of the Pull Request # @return String # def pr_body @github.pr_json[:body].to_s end # @!group PR Metadata # The username of the author of the Pull Request # @return String # def pr_author @github.pr_json[:user][:login].to_s end # @!group PR Metadata # The labels assigned to the Pull Request # @return [String] # def pr_labels @github.issue_json[:labels].map { |l| l[:name] } end # @!group PR Commit Metadata # The branch to which the PR is going to be merged into # @return String # def branch_for_merge @github.pr_json[:base][:ref] end # @!group PR Commit Metadata # The base commit to which the PR is going to be merged as a parent # @return String # def base_commit @github.pr_json[:base][:sha] end # @!group PR Commit Metadata # The head commit to which the PR is requesting to be merged from # @return String # def head_commit @github.pr_json[:head][:sha] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
danger-0.8.3 | lib/danger/danger_core/plugins/dangerfile_github_plugin.rb |
danger-0.8.2 | lib/danger/danger_core/plugins/dangerfile_github_plugin.rb |