iT邦幫忙

2024 iThome 鐵人賽

DAY 18
0
DevOps

將 AI Code Review 整進 CICD系列 第 18

將 AI Code Review 整進 CICD Day18

  • 分享至 

  • xImage
  •  

Review 的最後,是新增HelpMessage。另外如果設置啟用相關設定,則 show_relevant_configurations。並在最後設定 label

 # Add help text if gfm_markdown is supported
        if self.git_provider.is_supported("gfm_markdown") and get_settings().pr_reviewer.enable_help_text:
            markdown_text += "<hr>\n\n<details> <summary><strong>💡 Tool usage guide:</strong></summary><hr> \n\n"
            markdown_text += HelpMessage.get_review_usage_guide()
            markdown_text += "\n</details>\n"

        # Output the relevant configurations if enabled
        if get_settings().get('config', {}).get('output_relevant_configurations', False):
            markdown_text += show_relevant_configurations(relevant_section='pr_reviewer')

        # Add custom labels from the review prediction (effort, security)
        self.set_review_labels(data)

最後將 markdown_text return 出去,讓 PRReviewer run 執行最後的 publish comment

        pr_review = self._prepare_pr_review()
            get_logger().debug(f"PR output", artifact=pr_review)

            if get_settings().config.publish_output:
                # publish the review
                if get_settings().pr_reviewer.persistent_comment and not self.incremental.is_incremental:
                    final_update_message = get_settings().pr_reviewer.final_update_message
                    self.git_provider.publish_persistent_comment(pr_review,
                                                                 initial_header=f"{PRReviewHeader.REGULAR.value} 🔍",
                                                                 update_header=True,
                                                                 final_update_message=final_update_message, )
                else:
                    self.git_provider.publish_comment(pr_review)

上一篇
將 AI Code Review 整進 CICD Day17
下一篇
鬼轉 ai RAG 技術研究與實踐 Day 1
系列文
將 AI Code Review 整進 CICD24
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言