Class: Pghub::Base::WebhooksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pghub/base/webhooks_controller.rb

Constant Summary collapse

VALID_ACTIONS =
%w[
  opened
  edited
  created
  edited
  review_requested
  submitted
].freeze

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/pghub/base/webhooks_controller.rb', line 14

def create
  return unless VALID_ACTIONS.include?(action)

  if defined? Pghub::Lgtm
    Pghub::Lgtm.post(issue_path) if input.include?('LGTM')
  end

  if defined? Pghub::IssueTitle
    Pghub::IssueTitle.post(issue_path, input) if input.include?('ref')
  end

  if defined? Pghub::AutoAssign
    if params[:webhook][:pull_request].present? && action == 'opened'
      Pghub::AutoAssign.post(issue_path, opened_pr_user)
    end
  end

  head 200
end