2024-05-03 03:04:43 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module OceanicWs
|
|
|
|
class GithubWebhooksController < ActionController::API
|
|
|
|
include GithubWebhook::Processor
|
|
|
|
|
|
|
|
def github_push(payload)
|
|
|
|
if payload[:ref].starts_with?("refs/tags/")
|
|
|
|
BuildOceanicDocsJob.perform_later(:tag, payload)
|
2024-05-04 04:35:08 +00:00
|
|
|
elsif payload[:ref].starts_with?("refs/heads/")
|
|
|
|
BuildOceanicDocsJob.perform_later(:branch, payload)
|
2024-05-03 03:04:43 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
head(204)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def webhook_secret(_payload)
|
|
|
|
Websites.config.github_webhook_secret
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|