Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow fails if categories property is missing in the properties file #41

Closed
SableRaf opened this issue Jan 11, 2025 · 1 comment · Fixed by #42
Closed

Workflow fails if categories property is missing in the properties file #41

SableRaf opened this issue Jan 11, 2025 · 1 comment · Fixed by #42

Comments

@SableRaf
Copy link
Contributor

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:

  1. 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)
  2. 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.

Copy link

There was an error in reading your properties file or parsing it.

Please ensure that the URL is correct and the file follows the required format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant