-
Notifications
You must be signed in to change notification settings - Fork 68
Implement support for forgejo commit statuses #936
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
Implement support for forgejo commit statuses #936
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @betulependule, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the integration with Forgejo by providing complete support for commit statuses. It allows the system to both retrieve and set detailed status information for commits, improving visibility into the state of development processes on Forgejo repositories.
Highlights
- Forgejo Commit Status Management: Implemented the full functionality for managing commit statuses on Forgejo. This includes the
getmethod to retrieve existing statuses for a commit and thesetmethod to create or update commit statuses, allowing for comprehensive status reporting. - New Commit Status State: Expanded the
CommitStatusenum by adding a newwarningstate. This provides a more granular way to report the outcome of automated checks and processes. - API Integration and Error Handling: Integrated with the
pyforgejolibrary to interact with the Forgejo API for status operations. Robust error handling has been added to gracefully manage scenarios such as a commit not being found on the Forgejo instance.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request implements support for Forgejo commit statuses. There were a few issues identified, including a critical one that would cause an infinite recursion. Suggestions were provided to improve correctness and adhere to idiomatic Python.
|
Build succeeded. ✔️ pre-commit SUCCESS in 3m 15s |
|
Build succeeded. ✔️ pre-commit SUCCESS in 2m 59s |
mfocko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for those few remarks looks OK :)
ogr/abstract.py
Outdated
| error = 4 | ||
| canceled = 5 | ||
| running = 6 | ||
| warning = 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did you find warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see now where you found the warning… it's only mentioned in the filtering 🤦 not sure if it can be used, or how can you get there /o\
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, it will work, it's just not documented :) checked the forgejo source, LOL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and it's a partial revert, it got removed in Gitea, but it breaks some parts of the automation, so they reverted it just partially 🤦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I remove warning then? I found it here forgejo.dev.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can keep it, I'll open up issue on upstream to check what's the plan with that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AAAAAA, I still haven't opened up the issue /o
|
Build failed. ✔️ pre-commit SUCCESS in 3m 52s |
|
Build failed. ✔️ pre-commit SUCCESS in 3m 00s |
| assert flag.state == CommitStatus.success | ||
| assert flag.comment == "Initial commit" | ||
| assert flag.context == "default" | ||
| assert flag.created.year == 2019 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I've realized I'm testing for a non-existing commit status (I misunderstood what a commit status is previously). Will fix this once I figure out why I keep getting pyforgejo API errors.
|
Build failed. ✔️ pre-commit SUCCESS in 3m 05s |
|
Tests are probably failing because of missing .yaml files that should have been generated by recording tests. They are passing locally when using tmt. Will look into how to get these files generated. |
I was a bit afraid that this might happen, cause tmt copies the repo over, so you are generating the responses, but they are not copied back to the repo from where you run the tmt. To not get off-topic, you should be able to get the path to the latest tmt run without running it1… I've been able to get: with And given the path to the logs ( Footnotes
|
Thank you. I'll try it today. :) |
|
Build succeeded. ✔️ pre-commit SUCCESS in 3m 23s |
Signed-off-by: Matej Focko <[email protected]>
Signed-off-by: Matej Focko <[email protected]>
Signed-off-by: Matej Focko <[email protected]>
Signed-off-by: Matej Focko <[email protected]>
|
Build succeeded. ✔️ pre-commit SUCCESS in 3m 08s |
Implement support for forgejo commit statuses in ogr/services/forgejo/flag.py. Add 'warning' status to CommitStatus in ogr/abstract.py applicable forgejo commits.
ba2bc87 to
3bcb4f3
Compare
|
Build succeeded. ✔️ pre-commit SUCCESS in 3m 06s |
Co-authored-by: Matej Focko <[email protected]>
|
Build succeeded. ✔️ pre-commit SUCCESS in 2m 58s |
|
Build succeeded (gate pipeline). ✔️ pre-commit SUCCESS in 3m 05s |
6efda99
into
packit:main
Implement support for forgejo commit statuses and add relevant tests to test new functionality. Also add "warning" commit status used by forgejo.
Fixes #882
Related to #866