5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 01:56:21 +00:00
panel/app/controllers/api/v1/webhooks_controller.rb

22 lines
638 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Api
module V1
# Recibe webhooks y lanza jobs
class WebhooksController < BaseController
2023-07-27 19:46:32 +00:00
# Trae los cambios a partir de un post de Webhooks:
# (Gitlab, Github, Guitea, etc)
def pull
2023-07-27 19:46:32 +00:00
site = Site.find_by_name!(params[:site_id])
usuarie = GitAuthor.new email: "webhook@#{Site.domain}", name: 'Webhook'
2023-07-27 19:46:32 +00:00
message = I18n.with_locale(site.default_locale) do
I18n.t('webhooks.pull.message')
end
GitPullJob.perform_later(site, usuarie, message)
head :ok
end
end
end
end