Skip to content

Commit

Permalink
fix actions
Browse files Browse the repository at this point in the history
  • Loading branch information
pompurin404 committed Oct 23, 2024
1 parent da56fe0 commit d5fef92
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Auto Close Issue
uses: mihomo-party-org/auto-close-issue@main
uses: mihomo-party-org/auto-close-issues@main
with:
title: ${{ github.event.issue.title }}
body: ${{ github.event.issue.body }}
number: ${{ github.event.issue.number }}
token: ${{ secrets.GITHUB_TOKEN }}
url: 'https://api.openai.com'
key: 'sk-xxxxxx'
Expand Down
16 changes: 10 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,34 @@ description: "Review and automatically close issues through OpenAI"
inputs:
title:
description: "Issue title"
required: true
required: false
default: ${{ github.event.issue.title }}
body:
description: "Issue body"
required: true
required: false
default: ${{ github.event.issue.body }}
number:
description: "Issue number"
required: true
required: false
default: ${{ github.event.issue.number }}
repo:
description: "Repository"
required: false
default: ${{ github.repository }}
token:
description: "GitHub token"
required: true
default: ${{ secrets.GITHUB_TOKEN }}
url:
description: "OpenAI API Base URL"
required: true
required: false
default: "https://api.openai.com"
key:
description: "OpenAI API Key"
required: true
prompt:
description: "OpenAI system prompt"
required: false
default: You are an AI assistant specialized in analyzing GitHub issues. Your task is to evaluate the title and body of a given issue and determine if they align with the selected options or checkboxes in the issue template, especially focusing on the "Verify steps" section. Finally give the evaluation result, whether the issue should be closed, whether the issue needs to be locked, and the reasons in Chinese. Consider all available information, not just the checkboxes. If there's not enough information to make a determination, state that in your response. If the content involves abusive or inappropriate language, please lock the issues
default: You are an AI assistant specialized in analyzing GitHub issues. Your task is to evaluate the title and body of a given issue and determine if it should be closed or lock. If you believe the issue should be closed, please provide a reason for your decision.

runs:
using: "composite"
Expand All @@ -47,6 +50,7 @@ runs:
ISSUE_TITLE: ${{ inputs.title }}
ISSUE_BODY: ${{ inputs.body }}
ISSUE_NUMBER: ${{ inputs.number }}
GITHUB_REPO: ${{ inputs.repo }}
GITHUB_TOKEN: ${{ inputs.token }}
API_URL: ${{ inputs.url }}
API_KEY: ${{ inputs.key }}
Expand Down
22 changes: 11 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
var (
ctx context.Context
client *github.Client
owner = "mihomo-party-org"
repo = "mihomo-party"
owner string
repo string
issue IssueInfo
prompt string
)
Expand All @@ -49,9 +49,11 @@ func init() {
)
tc := oauth2.NewClient(ctx, ts)
client = github.NewClient(tc)
githubRepo := strings.Split(os.Getenv("GITHUB_REPO"), "/")
owner, repo = githubRepo[0], githubRepo[1]
issueNumber, err := strconv.Atoi(os.Getenv("ISSUE_NUMBER"))
if err != nil {
log.Fatal(err)
log.Fatalln(err)
}
issue = IssueInfo{
Title: os.Getenv("ISSUE_TITLE"),
Expand All @@ -68,27 +70,25 @@ func main() {
内容: "%s"`, issue.Title, issue.Body)

content1, err := chat(c, "gpt-4o-mini")
log.Println(content1)
if err != nil {
log.Println(err)
log.Fatalln(err)
}
gpt4omini, err := parse(content1)
if err != nil {
log.Println(err)
log.Fatalln(err)
}

content2, err := chat(c, "gpt-4o")
log.Println(content2)
if err != nil {
log.Println(err)
log.Fatalln(err)
}
gpt4o, err := parse(content2)
if err != nil {
log.Println(err)
log.Fatalln(err)
}

fmt.Println(gpt4omini)
fmt.Println(gpt4o)
fmt.Println(content1)
fmt.Println(content2)

if gpt4omini.Close && gpt4o.Close {
closeIssue(issue.Number, gpt4o.Content)
Expand Down

0 comments on commit d5fef92

Please sign in to comment.