5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-17 23:36:22 +00:00

fix: commit message fixed #13903
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
jazzari 2023-07-27 16:46:32 -03:00
parent b7e93cd8c8
commit 8947942cb9
4 changed files with 10 additions and 7 deletions

View file

@ -4,11 +4,14 @@ 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
# encontrar el sitio
site = Site.find_by_name(params[:site_id])
site = Site.find_by_name!(params[:site_id])
usuarie = GitAuthor.new email: "webhook@#{Site.domain}", name: 'Webhook'
message = I18n.t('webhooks.pull.message')
message = I18n.with_locale(site.default_locale) do
I18n.t('webhooks.pull.message')
end
GitPullJob.perform_later(site, usuarie, message)
end

View file

@ -6,8 +6,8 @@ class GitPullJob < ApplicationJob
# @param :site [Site]
# @param :usuarie [Usuarie]
# @return [nil]
def perform(site, usuarie)
def perform(site, usuarie, message)
site.repository.fetch
site.repository.merge(usuarie)
site.repository.merge(usuarie, message) if site.repository.fetch&.positive?
end
end

View file

@ -56,7 +56,7 @@ class Site
# Incorpora los cambios en el repositorio actual
#
# @return [Rugged::Commit]
def merge(usuarie, message)
def merge(usuarie, message= I18n.t('sites.fetch.merge.message'))
merge = rugged.merge_commits(head_commit, remote_head_commit)
# No hacemos nada si hay conflictos, pero notificarnos

View file

@ -468,7 +468,7 @@ en:
message: 'Skeleton upgrade'
webhooks_controller:
pull:
message: 'Webhooks upgrade'
message: 'Webhooks pull'
footer:
powered_by: 'is developed by'
i18n: