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