This commit is contained in:
mrT23
2023-11-13 15:55:35 +02:00
parent a8dddd1999
commit 0df0542958
3 changed files with 6 additions and 6 deletions

View File

@ -341,7 +341,7 @@ def set_custom_labels(variables):
# final_labels += f" - {k} ({v['description']})\n" # final_labels += f" - {k} ({v['description']})\n"
#variables["custom_labels"] = final_labels #variables["custom_labels"] = final_labels
#variables["custom_labels_examples"] = f" - {list(labels.keys())[0]}" #variables["custom_labels_examples"] = f" - {list(labels.keys())[0]}"
variables["custom_labels_class"] = "class Label(Enum):" variables["custom_labels_class"] = "class Label(str, Enum):"
for k, v in labels.items(): for k, v in labels.items():
description = v['description'].strip('\n').replace('\n', '\\n') description = v['description'].strip('\n').replace('\n', '\\n')
variables["custom_labels_class"] += f"\n {k.lower().replace(' ', '_')} = '{k}' # {description}" variables["custom_labels_class"] += f"\n {k.lower().replace(' ', '_')} = '{k}' # {description}"

View File

@ -20,7 +20,7 @@ The output must be a YAML object equivalent to type $Labels, according to the fo
{{ custom_labels_class }} {{ custom_labels_class }}
{%- else %} {%- else %}
class Label(Enum): class Label(str, Enum):
bug_fix = "Bug fix" bug_fix = "Bug fix"
tests = "Tests" tests = "Tests"
refactoring = "Refactoring" refactoring = "Refactoring"
@ -30,7 +30,7 @@ class Label(Enum):
{%- endif %} {%- endif %}
class Labels(BaseModel): class Labels(BaseModel):
labels: List[Label] = Field(min_items=0, description="custom labels that describe the PR") labels: List[Label] = Field(min_items=0, description="custom labels that describe the PR. Return the label value, not the name.")
' '

View File

@ -16,7 +16,7 @@ Extra instructions from the user:
The output must be a YAML object equivalent to type $PRDescription, according to the following Pydantic definitions: The output must be a YAML object equivalent to type $PRDescription, according to the following Pydantic definitions:
' '
Class PRType(Enum): class PRType(str, Enum):
bug_fix = "Bug fix" bug_fix = "Bug fix"
tests = "Tests" tests = "Tests"
refactoring = "Refactoring" refactoring = "Refactoring"
@ -35,10 +35,10 @@ class FileWalkthrough(BaseModel):
Class PRDescription(BaseModel): Class PRDescription(BaseModel):
title: str = Field(description="an informative title for the PR, describing its main theme") title: str = Field(description="an informative title for the PR, describing its main theme")
type: List[PRType] = Field(description="one or more types that describe the PR type") type: List[PRType] = Field(description="one or more types that describe the PR type. . Return the label value, not the name.")
description: str = Field(description="an informative and concise description of the PR. {%- if use_bullet_points %} Use bullet points. {% endif %}") description: str = Field(description="an informative and concise description of the PR. {%- if use_bullet_points %} Use bullet points. {% endif %}")
{%- if enable_custom_labels %} {%- if enable_custom_labels %}
labels: List[Label] = Field(min_items=0, description="custom labels that describe the PR") labels: List[Label] = Field(min_items=0, description="custom labels that describe the PR. Return the label value, not the name.")
{%- endif %} {%- endif %}
main_files_walkthrough: List[FileWalkthrough] = Field(max_items=10) main_files_walkthrough: List[FileWalkthrough] = Field(max_items=10)
' '