mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-18 01:46:25 +00:00
fix: commit message fixed #13903
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
b7e93cd8c8
commit
8947942cb9
4 changed files with 10 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -468,7 +468,7 @@ en:
|
|||
message: 'Skeleton upgrade'
|
||||
webhooks_controller:
|
||||
pull:
|
||||
message: 'Webhooks upgrade'
|
||||
message: 'Webhooks pull'
|
||||
footer:
|
||||
powered_by: 'is developed by'
|
||||
i18n:
|
||||
|
|
Loading…
Reference in a new issue