-
Notifications
You must be signed in to change notification settings - Fork 1
feat(tibuild): enhance devbuild_poll command with templated markdown response #256
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
Conversation
OverviewThis pull request enhances the Code Quality
Functionality
Documentation
SecurityNo security issues were identified in the provided diff patch. Suggestions
|
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.
Hello @wuhuizuo, 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!
Summary of Changes
This pull request enhances the devbuild_poll
command in the chatops-lark application to provide a more informative and readable response in Markdown format. Instead of returning a simple JSON representation of the build status, it now uses a templated Markdown response that includes the build status, pipeline view links (if available), and a build report (if available), formatted as YAML. The changes also include removing some logging in root.go
and adding more detailed logging within the goroutine that handles commands.
Highlights
- Templated Markdown Response: The
devbuild_poll
command now returns a formatted Markdown response using a template file (devbuild_poll.md.tmpl
) instead of a JSON string. This makes the output more readable and user-friendly. - Template Functionality: The template utilizes the
sprig
library for additional functions and defines a customtoYaml
function to format the build report data into YAML within the Markdown response. - Logging Enhancement: The logging in
root.go
was moved inside the goroutine to provide more detailed asynchronous logging, including command name, arguments, and sender information. - Error Handling: The error handling within the command processing goroutine in
root.go
has been enhanced to log different error types (SkipError, InformationError, default error) with appropriate messages.
Changelog
Click here to see the changelog
- chatops-lark/pkg/events/handler/devbuild_poll.go
- Replaced JSON marshaling with Markdown templating for the
devbuild_poll
command response. - Introduced
devBuildPollResponseTmpl
variable to store the Markdown template fromdevbuild_poll.md.tmpl
. - Added
sprig
functions and a customtoYaml
function to the template for formatting the output. - Modified the
runCommandDevbuildPoll
function to execute the template with the build result data.
- Replaced JSON marshaling with Markdown templating for the
- chatops-lark/pkg/events/handler/devbuild_poll.md.tmpl
- Created a new template file to define the Markdown structure for the
devbuild_poll
command response. - Implemented conditional rendering for pipeline view links and build report sections.
- Used
toYaml
function to format the build report data as YAML within the Markdown output.
- Created a new template file to define the Markdown structure for the
- chatops-lark/pkg/events/handler/root.go
- Removed the initial logging statement before command handling.
- Added more detailed logging within the command processing goroutine, including command name, arguments, and sender information.
- Enhanced error handling within the goroutine to log different error types with appropriate messages.
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 is currently in preview and 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 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.
A command's response,
In Markdown, it finds its form,
Data now so clear.
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
The pull request enhances the devbuild_poll
command by introducing a templated markdown response. This change improves the readability and presentation of the build status information. The use of Go templates and the sprig
library allows for more flexible and dynamic formatting of the output. Additionally, the integration of YAML formatting for build reports provides a structured and easily understandable view of the data.
Summary of Findings
- Error Handling in YAML Marshaling: The current error handling for YAML marshaling in the
toYaml
function returns a string with the error message. While this prevents the application from crashing, it might be better to return an error to the caller function so that it can handle the error appropriately. This would allow the caller to log the error or take other actions based on the error type. I have not commented on this due to the review settings. - Logging Enhancement: The logging statements in
root.go
have been improved by adding more context, such as command name, arguments, and sender information. This enhancement provides better visibility into the command processing flow and helps in debugging issues. I have not commented on this due to the review settings.
Merge Readiness
The pull request is well-structured and introduces a valuable enhancement to the devbuild_poll
command. The use of templated markdown responses improves the user experience by providing a more readable and informative output. The changes in root.go
enhance the logging capabilities, making it easier to track and debug command executions. Overall, the code is in good shape, and I recommend merging it after addressing the error handling in YAML marshaling. I am unable to approve this pull request, and recommend that others review and approve this code before merging.
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wuhuizuo The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
No description provided.