corp-0 / pr2changelog

1 stars 0 forks source link

Sweep: Handle the case of empty body. #35

Open corp-0 opened 1 year ago

corp-0 commented 1 year ago

When the user didn't write anything on their PR body, Github skips the key in their payload, causing pr2changelog to raise a MissingContextInformation exception and instantly failing.

It should instead output that no changes were found.

sweep-ai[bot] commented 1 year ago
Sweeping

25%

Actions (click)


❌ Unable to Complete PR

I'm sorry, but it looks like an error has occurred. Try changing the issue description to re-trigger Sweep. If this error persists report it at https://discord.gg/sweep.

For bonus GPT-4 tickets, please report this bug on Discord.


Please look at the generated plan. If something looks wrong, please add more details to your issue.

File Path Proposed Changes
pr2changelog/context.py Modify pr2changelog/context.py with contents:
• In the Context class, identify the method where the PR body is processed. This is likely where the MissingContextInformation exception is raised when the PR body is empty.
• Modify this method to check if the PR body key is present in the Github payload. This can be done using the 'in' keyword in Python.
• If the PR body key is not present in the payload, instead of raising a MissingContextInformation exception, set the PR body to a default value indicating that no changes were found. This could be a simple string like "No changes were found".
• Ensure that the rest of the application can handle this default value correctly. This might involve modifying other methods in the Context class or even in other classes that use the Context class.

🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.