Closed
Description
Description:
The workflow currently fails if the categories
property is missing from the properties file provided as input. This results in a KeyError
when attempting to access props['categories']
.
Error log excerpt:
File "/home/runner/work/processing-contributions/processing-contributions/scripts/add_new_contribution_to_yaml.py", line 18, in <module>
if props['categories']:
~~~~~^^^^^^^^^^^^^^
KeyError: 'categories'
Error: Process completed with exit code 1.
Steps to Reproduce:
- Run the workflow with a properties file that does not include the
categories
property (for example: https://github.com/KrabCode/LazyGui/releases/download/latest/LazyGui.txt) - Observe the workflow failing with the above error.
Proposed Solution:
Add a check for the existence of the key and provide a default value (None
) if it is not present:
if 'categories' in props and props['categories']:
props['categories'] = sorted(props['categories'].replace('"', '').split(','))
props['categories'] = [category.strip() for category in props['categories']]
else:
props['categories'] = None
Additional Notes
I'll make a PR shortly that will address this issue.
Metadata
Metadata
Assignees
Labels
No labels