避免重复写入pr历史数据
This commit is contained in:
parent
b556dc943e
commit
451a6d8b42
@ -143,19 +143,20 @@ class GitLabProvider(GitProvider):
|
|||||||
if request_data.get('object_attributes', {}).get(
|
if request_data.get('object_attributes', {}).get(
|
||||||
"source_branch"
|
"source_branch"
|
||||||
) and request_data.get('object_attributes', {}).get("target_branch"):
|
) and request_data.get('object_attributes', {}).get("target_branch"):
|
||||||
models.ProjectHistory.objects.create(
|
if not models.ProjectHistory.objects.filter(project_id=project_id, mr_url=request_data.get('object_attributes', {}).get("url")).exists():
|
||||||
project_id=project_id,
|
models.ProjectHistory.objects.create(
|
||||||
project_url=request_data.get("project", {}).get("web_url"),
|
project_id=project_id,
|
||||||
mr_url=request_data.get('object_attributes', {}).get("url"),
|
project_url=request_data.get("project", {}).get("web_url"),
|
||||||
source_branch=request_data.get('object_attributes', {}).get(
|
mr_url=request_data.get('object_attributes', {}).get("url"),
|
||||||
"source_branch"
|
source_branch=request_data.get('object_attributes', {}).get(
|
||||||
),
|
"source_branch"
|
||||||
target_branch=request_data.get('object_attributes', {}).get(
|
),
|
||||||
"target_branch"
|
target_branch=request_data.get('object_attributes', {}).get(
|
||||||
),
|
"target_branch"
|
||||||
mr_title=request_data.get('object_attributes', {}).get("title"),
|
),
|
||||||
source_data=request_data,
|
mr_title=request_data.get('object_attributes', {}).get("title"),
|
||||||
)
|
source_data=request_data,
|
||||||
|
)
|
||||||
|
|
||||||
def run_command(self, mr_url, project_commands):
|
def run_command(self, mr_url, project_commands):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user