From 362aee1a359cc45633ef2db167e11441c0ab6f67 Mon Sep 17 00:00:00 2001 From: yystopf Date: Sat, 11 May 2024 11:43:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9Agithub=20webhook?= =?UTF-8?q?=E7=89=B9=E6=AE=8A=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/projects/sync_repositories_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/projects/sync_repositories_controller.rb b/app/controllers/api/v1/projects/sync_repositories_controller.rb index 047800415..740c92b2f 100644 --- a/app/controllers/api/v1/projects/sync_repositories_controller.rb +++ b/app/controllers/api/v1/projects/sync_repositories_controller.rb @@ -29,7 +29,7 @@ class Api::V1::Projects::SyncRepositoriesController < Api::V1::BaseController else @sync_repositories = SyncRepository.where(project: @project, sync_direction: params[:sync_direction]) end - branch = params[:ref].split("refs/heads/")[-1] + branch = params[:payload].present? ? JSON.parse(params[:payload])["ref"].split("/")[-1] : params[:ref].split("/")[-1] rescue nil if params[:sync_direction].to_i == 1 @sync_repository_branches = SyncRepositoryBranch.where(sync_repository_id: @sync_repositories, gitlink_branch_name: branch, enable: true) else