1
+ ---
1
2
name : AI Issue Responder
2
3
3
4
on :
@@ -13,58 +14,16 @@ jobs:
13
14
runs-on : ubuntu-latest
14
15
15
16
steps :
16
- - name : Get issue content
17
- id : get_issue
18
- env :
19
- ISSUE_TITLE : ${{ github.event.issue.title }}
20
- ISSUE_BODY : ${{ github.event.issue.body }}
17
+ - name : Download AI responder script
21
18
run : |
22
- echo "title=$ISSUE_TITLE" >> "$GITHUB_OUTPUT"
23
- echo "body=$ISSUE_BODY" >> "$GITHUB_OUTPUT"
24
-
25
- - name : Call OpenAI API
26
- id : ai
27
- env :
28
- OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
29
- ISSUE_TITLE : ${{ steps.get_issue.outputs.title }}
30
- ISSUE_BODY : ${{ steps.get_issue.outputs.body }}
31
- run : |
32
- prompt="You're a helpful AI assistant. "
33
- prompt+="Reply concisely to the following GitHub issue."
34
-
35
- json=$(jq -n \
36
- --arg model "gpt-4o" \
37
- --arg system "$prompt" \
38
- --arg user "$ISSUE_TITLE - $ISSUE_BODY" \
39
- '{
40
- model: $model,
41
- messages: [
42
- {role: "system", content: $system},
43
- {role: "user", content: $user}
44
- ],
45
- temperature: 0.5
46
- }')
19
+ curl -sSL "https://raw.githubusercontent.com/dmzoneill/dmzoneill/main/ai-responder.py" -o ai-responder.py
20
+ chmod +x ai-responder.py
47
21
48
- api_url="https://api.openai.com/v1/chat/completions"
49
- auth="Authorization: Bearer $OPENAI_API_KEY"
50
- ctype="Content-Type: application/json"
51
-
52
- response=$(curl -s "$api_url" \
53
- -H "$auth" \
54
- -H "$ctype" \
55
- -d "$json" | jq -r '.choices[0].message.content')
56
-
57
- echo "reply=$response" >> "$GITHUB_OUTPUT"
58
-
59
- - name : Reply to issue
22
+ - name : Run AI responder
60
23
env :
61
- COMMENT_BODY : ${{ steps.ai.outputs.reply }}
62
- run : |
63
- api_url="https://api.github.com/repos/${{ github.repository }}"
64
- api_url+="/issues/${{ github.event.issue.number }}/comments"
65
-
66
- curl -s -X POST \
67
- -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
68
- -H "Accept: application/vnd.github.v3+json" \
69
- "$api_url" \
70
- -d "$(jq -n --arg body "$COMMENT_BODY" '{body: $body}')"
24
+ OPENAI_API_KEY : ${{ secrets.AI_API_KEY }}
25
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
26
+ GITHUB_REPOSITORY : ${{ github.repository }}
27
+ ISSUE_NUMBER : ${{ github.event.issue.number }}
28
+ ISSUE_REPO_URL : " https://github.com/${{ github.repository }}"
29
+ run : ./ai-responder.py
0 commit comments