Skip to content
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

GitHub Issue Summarizer using Modus & GitHub Actions #64

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b2e6710
add new github summarizor example
StephDietz Jan 30, 2025
899fcaa
Merge branch 'main' into modus-gh-issue-recap
johnymontana Feb 9, 2025
9b92031
trunk format
johnymontana Feb 9, 2025
a3a98b1
cleanup
johnymontana Feb 9, 2025
a44d77f
use format string
johnymontana Feb 11, 2025
6090bbf
Exclude false positive CVEs
johnymontana Feb 11, 2025
e9f712b
Merge branch 'main' into modus-gh-issue-recap
johnymontana Feb 11, 2025
850a6e5
Merge branch 'main' into modus-gh-issue-recap
johnymontana Feb 12, 2025
4b3bea8
Update modus-gh-issue-summarizer/go.mod
johnymontana Feb 12, 2025
3eb9ac4
Update modus-gh-issue-summarizer/go.mod
johnymontana Feb 12, 2025
fda8b3c
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
625838f
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
abe1f24
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
a774ac1
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
0c6ca86
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
9e8f289
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
1d95762
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
4cebe90
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
b30d433
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
ffc4f4e
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
5046500
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
629b957
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
74d84da
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
fb77146
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
6dd9e12
Update modus-gh-issue-summarizer/main.go
johnymontana Feb 12, 2025
b421e19
update readme
johnymontana Feb 13, 2025
f236d64
update go.sum
johnymontana Feb 13, 2025
b0e075a
trunk fmt
johnymontana Feb 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions modus-gh-issue-summarizer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Ignore macOS system files
.DS_Store

# Ignore environment variable files
.env
.env.*

# Ignore build output directories
build/

# Ignore Go debuger and generated files
__debug_bin*
*_generated.go
*.generated.go

.modusdb/
110 changes: 110 additions & 0 deletions modus-gh-issue-summarizer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# GitHub Issue Knowledge Base Generator (Modus + Hypermode) 🚀

This project automatically generates a Knowledge Base (KB) article when a GitHub issue is closed. It
utilizes Hypermode and Modus (a serverless Go framework) to process issue data and generate a
structured KB article using an LLM. The knowledge base article is then posted as a GitHub
Discussion.

## 🛠 Features

- Fetches GitHub issue details and comments upon issue closure.
- Uses LLM (Meta's LLaMa model hosted on Hypermode) to generate a detailed KB article.
- Posts the generated KB article as a GitHub Discussion.
- Can be triggered manually or via GitHub Actions.

--

## 🖥️ Running Locally

### 1️⃣ Install Modus
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May want to mention that for this example you'll need Go and TinyGo installed also.


First, install Modus CLI:

```bash
npm install -g @hypermodeinc/modus
```

### 2️⃣ Clone the Repository
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to mention that this is a repository in which you want to run the summarizer.


```bash
git clone https://github.com/YOUR_USERNAME/YOUR_REPO.git
cd YOUR_REPO
```

### 3️⃣ Start the Modus Dev Server
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this stage the viewer is in their cloned repo right, how to they get the required files (main.go, modus.json, etc) into this folder? Maybe I'm missing something.


```bash
modus dev
```

### 4️⃣ Test the API Locally

Go to: `http://localhost:54321/graphql`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I modus dev from the new folder in your branch, the handler runs on 8686. Don't see anywhere where this is configured for 54321.


You'll see an exported function `issueClosedHandler`. Test the KB Article Generation. Enter the
repository name and issue number and run the query. The API will return a formatted KB article. You
can also post the KB Article as a Discussion. To do so, pass a GitHub API token as well.

--

## 🚀 Deploying to Hypermode

To deploy the function to Hypermode:

```bash
modus deploy
```

Once deployed, copy your Hypermode endpoint, which will be used in the GitHub Action.

--

## 🔧 Setting Up the GitHub Action

This action allows the KB article to be generated automatically when an issue is closed.

### 1️⃣ Clone the Project & Deploy to Hypermode

If you haven't already:

```bash
git clone https://github.com/YOUR_USERNAME/YOUR_REPO.git
cd YOUR_REPO
modus deploy
```

Copy your Hypermode endpoint as specified in the Hypermode console.

### 2️⃣ Add the GitHub Action

Copy the issue-summarizer.yml file into in your repository:

### 3️⃣ Add Your Hypermode API Key to GitHub Secrets

1. Go to your GitHub repository.
2. Navigate to Settings → Secrets and variables → Actions.
3. Click New repository secret.
4. Name it: `HYPERMODE_API_KEY`
5. Paste your Hypermode API key.
6. Save.

### 4️⃣ Done! 🎉

Now, every time a GitHub issue is closed, a KB article will be generated and posted as a GitHub
Discussion.

--

## 🛠 Troubleshooting

GitHub Discussion Not Created?

Ensure:

- You have enabled Discussions under Repository Settings → Features.
- Your GitHub token has the discussions: write permission.

No Response from the API?

- Check if your Modus function is deployed (modus deploy).
- Verify that your Hypermode API key is correct in GitHub Secrets.
14 changes: 14 additions & 0 deletions modus-gh-issue-summarizer/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module modus-gh-issue-summarizer

go 1.23.3

toolchain go1.23.5
johnymontana marked this conversation as resolved.
Show resolved Hide resolved

require github.com/hypermodeinc/modus/sdk/go v0.17.0
johnymontana marked this conversation as resolved.
Show resolved Hide resolved

require (
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
)
12 changes: 12 additions & 0 deletions modus-gh-issue-summarizer/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
github.com/hypermodeinc/modus/sdk/go v0.17.0 h1:vyS82iw31xuxqQKxiVtwrSNuF6hkMEJoynlcxthAeYM=
github.com/hypermodeinc/modus/sdk/go v0.17.0/go.mod h1:UzVpTQDjloJuErOiNP3Tma3N8crE5qwYfKQyX1ecKlA=
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
Loading
Loading