mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-05 21:30:40 +08:00
Add error handling for missing custom label settings in utils.py
This commit is contained in:
@ -674,14 +674,16 @@ def get_user_labels(current_labels: List[str] = None):
|
|||||||
Only keep labels that has been added by the user
|
Only keep labels that has been added by the user
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
enable_custom_labels = get_settings().config.get('enable_custom_labels', False)
|
||||||
|
custom_labels = get_settings().get('custom_labels', [])
|
||||||
if current_labels is None:
|
if current_labels is None:
|
||||||
current_labels = []
|
current_labels = []
|
||||||
user_labels = []
|
user_labels = []
|
||||||
for label in current_labels:
|
for label in current_labels:
|
||||||
if label.lower() in ['bug fix', 'tests', 'enhancement', 'documentation', 'other']:
|
if label.lower() in ['bug fix', 'tests', 'enhancement', 'documentation', 'other']:
|
||||||
continue
|
continue
|
||||||
if get_settings().config.enable_custom_labels:
|
if enable_custom_labels:
|
||||||
if label in get_settings().custom_labels:
|
if label in custom_labels:
|
||||||
continue
|
continue
|
||||||
user_labels.append(label)
|
user_labels.append(label)
|
||||||
if user_labels:
|
if user_labels:
|
||||||
|
Reference in New Issue
Block a user