Location>code7788 >text

Building a GitHub Issues Autosummarization Bot with FastGPT Workflows

Popularity๏ผš880 โ„ƒ/2024-10-30 15:38:00

Nowadays, the development of any project is very fast-paced, it is very important to keep abreast of project developments, and GitHub Issues is generally the main channel for developers and users to provide feedback.

However, as the number of Issues grows, it becomes increasingly difficult to follow up on each one in a timely manner.

To solve this pain point, we developed an automated Issue summarization bot that is simple:

  1. Automatically get the latest GitHub Issues for your project;
  2. Intelligently summarize Issues content;
  3. Push the summary to the designated Flybook group.

Next I will provide detailed steps to implement this robot step by step.

Without further ado, grab your keyboard and start teaching ~

Introducing the GitHub API

GitHub provides a powerful API that makes it easy to get Issues information. We'll use the following interface to get Issues for a repo:

  • /repos/{owner}/{repo}/issues

This interface returns the last 30 Issues by default.

can refer toGithub API Documentationfor more information.

FastGPT Introduction

FastGPT is a tool that makes the barriers to AI development dramatically lower.Whether you're a developer with a technical background, or just a novice interested in AI, FastGPT can help you get started easily, and even allow you to build an AI app of your own in minutes.

With traditional AI development, you need to master programming, algorithms, data processing, and other complex skills. But with FastGPT, you can start an AI application in just a few simple steps. Let's say, traditional AI development is like building a house by yourself, you not only need bricks, tiles, but also design drawings; while FastGPT is more like building blocks, you just need to choose the right module, put together a few pieces, and the house will immediately take shape.

This article will show you how to implement this robot step by step using FastGPT workflow.

FastGPT Workflow Build Process

First we have to log inFastGPT and create a new workflow:

Let's call it the GitHub Issue summary bot.

Then start adding nodes step by step. Next start breaking down the workflow and explaining it in detail.

1. Constructing the scope of the query

First of all, we need to use the current time node as a base to get the specific date 24 hours ago. The node to use is the [Code Run] node.

The full code is below:

function main() {
  const date = new Date();
  (() - 1);
  const day = ();
  const month = () + 1;
  const year = ();
  const hours = ();
  const minutes = ();

  return {
    date: `${year}-${month}-${day}T${hours}:${minutes}:000Z`,
  }
 }

2. Utilizing the GitHub API for Issues

In this step we'll use the [HTTP Request] node to access the GitHub API to get the Issues for a given project in the last 24 hours.

Here's an example of aFastGPT ProgramAs an example.

3. Processing API response data

After getting the raw data, we need to process it to extract the information we need. Again use the [Code Run] node.

The full code is below:

function main({res}) {
    const issues = (res);
    const ret = [];
    for(const issue of issues) {
        if (issue.pull_request) continue;
        ({
            title: ,
            body: ,
            url: issue.html_url
        })
    }

    return {
        ret: (ret)
    }
}

Since the issue interface treats pull_request as an issue as well, we can only filter it inside the code.

4. Summarizing content using a large language model

To generate high-quality summaries, we use a large language model to process and summarize Issues content.

The cue words are as follows:

You are a concise and efficient GitHub Issue overview assistant, specializing in distilling core issues and presenting them in a clear and concise manner.

## Task
Analyze the input of multiple issues and create a concise overview for each issue. Use Chinese output.

## Input format
JSON array, each item contains title, body and url.

## Output format
For each issue, use Markdown syntax to create concise overview blocks. Each summary should contain:

1. the original title of the issue, bolded
2. a short paragraph summarizing the issue (no more than 2-3 sentences)
3. a link to the original issue (using Markdown link syntax)

Use emoji in the summary to increase readability, but don't overdo it. Keep the overall style simple and clear.

Example output:

---

**๐Ÿ” Data Visualization Component Performance Optimization**

This issue reflects a slow loading of charts when working with large amounts of data. Users experiencing a noticeable performance degradation when the number of data points exceeds a certain number, affecting the user experience.

๐Ÿ“Ž [View original issue](url1)

---

**๐Ÿž Mobile interface adaptation issues**

This issue indicates that the interface layout is misaligned on certain specific models of mobile devices. This issue affects the consistent presentation of the app on different screen sizes.

๐Ÿ“Ž [View original issue](url2)

---

Please make sure that each issue summary is concise, highlights the core issue, and avoids excessive detail. Keep the overall style consistent so that readers can quickly understand the main points of each issue.

5. Flying Book Webhook Settings

Using the Webhook URL of the Flying Book Robot, we can push the summarized content to the specified Flying Book group. This step requires the [Flybook Robot webhook] node.

Here's the hook_url which we'll show you how to get in the next step.

6. Creating and setting up a Flying Book robot

First you need to access theFlying Book Robot Assistantpage, and then create a new robot application --> Create a process.

where the parameters of the Webhook trigger node are as follows:

{"content":{"text":"test"}}

The next node selects [Send Flybook Message], selects the send target as a group message, and specifies the group, and customizes a message title.

Then click on the "plus sign" in the message content and select Webhook Trigger -->.

Just save the final enable and wait for the administrator to review and approve it.

After approval, fill in the Webhook address of the [Webhook Trigger] node in the FastGPT workflow [Flying Book Robot webhook] node above.hook_url Center.

final result

After implementing this automation tool, your Flybook-related groups will receive a daily summary of Issues similar to the one shown below:

summarize

With the tutorials in this article, you should be able to see that you don't usually need to write a lot of code yourself at all.Just drag and drop some preset modules to get AI apps running!Even more complex solutions like summarizing GitHub Issues can be done with a small amount of JS code. Even more complex scenarios like summarizing GitHub Issues can be done with a small amount of JS code.

If you don't want to write even a little bit of code, that's fine too, just import the workflow I shared.

Workflow import method: Hover the mouse pointer over the title at the top left of the newly created workflow and click [Import Configuration].

Complete workflow:/s/019132869eca