Skip to content

Commit 164b34c

Browse files
committed
Improve general structure
1 parent 13edf72 commit 164b34c

File tree

7 files changed

+164
-95
lines changed

7 files changed

+164
-95
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
on:
2+
workflow_dispatch:
3+
push:
4+
tags:
5+
- '*'
6+
7+
permissions:
8+
contents: read
9+
packages: write
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
- name: install docker emulation
18+
run: docker run --rm --privileged tonistiigi/binfmt:latest --install amd64,arm64
19+
- name: Set up buildx
20+
uses: docker/setup-buildx-action@v3
21+
- name: Login to ghcr.io
22+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
23+
- name: Build and push
24+
run: |
25+
docker buildx build --platform linux/amd64,linux/arm64 -t $(echo 'ghcr.io/${{ github.repository }}:${{ github.ref_name }}' | tr '[:upper:]' '[:lower:]') --push .
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release Creation
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release:
10+
name: Create a Draft Release on GitHub
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Get Release Name
14+
id: get_release_name
15+
run: |
16+
echo "release_name=${GITHUB_REF_NAME/v/Version }" >> $GITHUB_ENV
17+
- name: Publish a Draft Release
18+
uses: softprops/action-gh-release@v2
19+
with:
20+
body: |
21+
## What's Changed
22+
23+
**Changelog:**
24+
draft: true # Creates a Draft Release
25+
name: ${{ steps.get_release_name.outputs.release_name }}
26+
generate_release_notes: true
27+
append_body: true

.gitignore

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
1-
# Binaries
2-
/bin
1+
# Binaries for programs and plugins
32
*.exe
43
*.exe~
54
*.dll
65
*.so
76
*.dylib
7+
bin/
88

9-
# Test binary
9+
# Test binary, built with `go test -c`
1010
*.test
1111

12-
# Output of the go coverage tool
12+
# Output of the go coverage tool, specifically when used with LiteIDE
1313
*.out
1414

15-
# Dependency directories
16-
/vendor/
15+
# Dependency directories (remove the comment below to include it)
16+
vendor/
17+
18+
# Go workspace file
19+
go.work
1720

1821
# IDE specific files
1922
.idea/
2023
.vscode/
2124
*.swp
22-
*.swo
25+
*.swo
26+
27+
# OS generated files
28+
.DS_Store
29+
.DS_Store?
30+
._*
31+
.Spotlight-V100
32+
.Trashes
33+
ehthumbs.db
34+
Thumbs.db
2335

2436
# sample workflow
2537
.github/workflows/issue-assistant.yml

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 WorkflowKit
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 57 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -17,48 +17,9 @@ AI-powered GitHub Issue assistant that provides intelligent responses based on r
1717
- 🧠 Multiple AI model support (OpenAI, Claude)
1818
- 📋 Customizable response templates
1919

20-
## Requirements
20+
## Quick Start
2121

22-
- Go 1.23 or higher
23-
- GitHub Personal Access Token (PAT) with `repo` scope
24-
- AI API Key (OpenAI or Anthropic)
25-
- Docker (optional, for containerized running)
26-
27-
## Environment Variables
28-
29-
| Variable | Description | Required | Default |
30-
|----------|-------------|----------|---------|
31-
| `GITHUB_TOKEN` | GitHub PAT with repo scope | Yes | - |
32-
| `OPENAI_API_KEY` | OpenAI API Key | Yes* | - |
33-
| `CLAUDE_API_KEY` | Anthropic Claude API Key | Yes* | - |
34-
| `AI_TYPE` | AI model type (openai/claude) | Yes | - |
35-
36-
*Either OPENAI_API_KEY or CLAUDE_API_KEY is required based on AI_TYPE
37-
38-
## Project Structure
39-
40-
```
41-
.
42-
├── cmd/
43-
│ └── issue-assistant/
44-
├── internal/
45-
│ └── helper/
46-
├── pkg/
47-
│ ├── ai/
48-
│ ├── github/
49-
│ └── logger/
50-
└── .github/
51-
└── workflows/
52-
```
53-
54-
## Setup
55-
56-
1. Create required secrets in your repository:
57-
- `GITHUB_TOKEN`: GitHub token with repo scope (automatically provided by GitHub Actions)
58-
- `OPENAI_API_KEY`: Your OpenAI API key (if using OpenAI)
59-
- `CLAUDE_API_KEY`: Your Claude API key (if using Claude)
60-
61-
2. Add the following workflow file to your repository (`.github/workflows/issue-assistant.yml`):
22+
1. Add this workflow to your repository (`.github/workflows/issue-assistant.yml`):
6223

6324
```yaml
6425
name: Issue Assistant
@@ -73,56 +34,71 @@ jobs:
7334
issues: write
7435
contents: read
7536
steps:
76-
- uses: actions/checkout@v3
37+
- uses: workflowkit/issue-assistant@v1
7738
with:
78-
repository: workflowkit/issue-assistant
79-
token: ${{ secrets.GITHUB_TOKEN }}
80-
path: .issue-assistant
81-
82-
- name: Build and run assistant
83-
working-directory: .issue-assistant
84-
env:
85-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86-
AI_TYPE: "openai" # or "claude"
87-
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
88-
CLAUDE_API_KEY: ${{ secrets.CLAUDE_API_KEY }}
89-
run: |
90-
docker build -t issue-assistant .
91-
docker run --rm \
92-
-e GITHUB_TOKEN \
93-
-e AI_TYPE \
94-
-e OPENAI_API_KEY \
95-
-e CLAUDE_API_KEY \
96-
-e GITHUB_EVENT_PATH \
97-
-v $GITHUB_EVENT_PATH:$GITHUB_EVENT_PATH \
98-
issue-assistant
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
ai_type: "openai" # or "claude"
41+
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
42+
# claude_api_key: ${{ secrets.CLAUDE_API_KEY }} # if using claude
43+
enable_comment: "true" # required: at least one feature must be enabled
44+
enable_label: "false" # required: at least one feature must be enabled
9945
```
10046
101-
## How It Works
47+
2. Add required secrets to your repository:
48+
- `OPENAI_API_KEY` (if using OpenAI)
49+
- `CLAUDE_API_KEY` (if using Claude)
10250

103-
1. When a new issue is opened, the workflow is triggered
104-
2. The assistant reads the repository content
105-
3. OpenAI GPT-4 analyzes the issue and repository content
106-
4. A detailed response is posted as a comment on the issue
107-
5. Confidence scoring ensures high-quality responses
51+
That's it! Now when someone opens an issue:
52+
- AI will analyze the issue content
53+
- AI will analyze your repository code
54+
- AI will post a helpful response as a comment
55+
- Optionally, AI can suggest labels
10856

109-
## Development
57+
## Configuration Options
11058

111-
```bash
112-
# Clone the repository
113-
git clone https://github.com/workflowkit/issue-assistant.git
59+
| Option | Description | Required | Default |
60+
|--------|-------------|----------|---------|
61+
| `github_token` | GitHub token (automatically provided) | Yes | - |
62+
| `ai_type` | AI model to use (`openai` or `claude`) | Yes | - |
63+
| `openai_api_key` | OpenAI API Key | Yes* | - |
64+
| `claude_api_key` | Claude API Key | Yes* | - |
65+
| `enable_comment` | Enable AI comments on issues | Yes** | false |
66+
| `enable_label` | Enable AI label suggestions | Yes** | false |
11467

115-
# Install dependencies
116-
go mod tidy
68+
*Either `openai_api_key` or `claude_api_key` is required based on `ai_type`
69+
**At least one feature (`enable_comment` or `enable_label`) must be enabled
11770

118-
# Run tests
119-
go test ./...
71+
## Advanced Usage
72+
73+
### Using with OpenAI:
74+
```yaml
75+
- uses: workflowkit/issue-assistant@v1
76+
with:
77+
github_token: ${{ secrets.GITHUB_TOKEN }}
78+
ai_type: "openai"
79+
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
80+
enable_comment: "true"
81+
```
12082

121-
# Build locally
122-
go build -o bin/issue-assistant
83+
### Using with Claude:
84+
```yaml
85+
- uses: workflowkit/issue-assistant@v1
86+
with:
87+
github_token: ${{ secrets.GITHUB_TOKEN }}
88+
ai_type: "claude"
89+
claude_api_key: ${{ secrets.CLAUDE_API_KEY }}
90+
enable_label: "true"
91+
```
12392

124-
# Build Docker image
125-
docker build -t issue-assistant .
93+
### Enable All Features:
94+
```yaml
95+
- uses: workflowkit/issue-assistant@v1
96+
with:
97+
github_token: ${{ secrets.GITHUB_TOKEN }}
98+
ai_type: "openai"
99+
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
100+
enable_comment: "true"
101+
enable_label: "true"
126102
```
127103

128104
## Contributing

action.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
name: 'Issue Assistant'
2-
description: 'AI-powered GitHub Issue assistant that provides intelligent responses based on repository content'
2+
description: 'AI-powered GitHub Issue assistant that provides intelligent responses and label suggestions using OpenAI GPT-4 or Anthropic Claude'
3+
author: 'workflowkit'
4+
5+
# Categories for GitHub Marketplace
6+
categories:
7+
- 'AI'
8+
- 'Code Review'
9+
- 'Issue Management'
10+
311
branding:
4-
icon: 'message-square'
5-
color: 'blue'
12+
icon: 'brain'
13+
color: 'purple'
614

715
inputs:
816
github_token:
@@ -21,11 +29,11 @@ inputs:
2129
enable_comment:
2230
description: 'Enable AI-powered code analysis comments on issues'
2331
required: false
24-
default: 'true'
32+
default: 'false' # Default is false, but you must enable if you want to use this action
2533
enable_label:
2634
description: 'Enable AI-powered label suggestions for issues'
2735
required: false
28-
default: 'false'
36+
default: 'false' # Default is false, but you must enable if you want to use this action
2937

3038
runs:
3139
using: 'docker'

internal/helper/helper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func (h *Helper) processLabels(ctx context.Context, event *GitHubEvent) {
247247

248248
// formatLabelExplanation formats the label explanation as a GitHub issue comment
249249
func (h *Helper) formatLabelExplanation(labels []string, explanation string) string {
250-
return fmt.Sprintf(`🏷️ AI Label Analysis
250+
return fmt.Sprintf(`🏷️ AI Label Assistant
251251
252252
I've added the following labels to this issue:
253253
%s
@@ -273,7 +273,7 @@ func formatLabelList(labels []string) string {
273273

274274
// formatComment formats the AI response as a GitHub issue comment
275275
func (h *Helper) formatComment(answer string) string {
276-
return fmt.Sprintf(`🤖 AI Assistant Analysis
276+
return fmt.Sprintf(`🤖 AI Issue Assistant
277277
278278
%s
279279

0 commit comments

Comments
 (0)