# frozen_string_literal: true module Api module V1 # Recibe webhooks y lanza jobs class WebhooksController < BaseController # Trae los cambios a partir de un post de Webhooks: # (Gitlab, Github, Guitea, etc) def pull site = Site.find_by_name!(params[:site_id]) usuarie = GitAuthor.new email: "webhook@#{Site.domain}", name: 'Webhook' 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