-
-
Notifications
You must be signed in to change notification settings - Fork 4
174 lines (153 loc) · 6.3 KB
/
Copy pathissue-automation.yml
File metadata and controls
174 lines (153 loc) · 6.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Issue and PR Automation
on:
issues:
types: [opened, reopened]
pull_request:
types: [opened, reopened]
schedule:
- cron: '30 1 * * *'
workflow_dispatch:
inputs:
issue_number:
description: 'Issue number for manual guidance comment'
required: false
type: string
jobs:
triage:
if: github.event_name == 'issues' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
steps:
- uses: actions/labeler@v6
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/labeler.yml
sync-labels: false
issue-guidance-and-summary:
if: github.event_name == 'issues' && github.event.action == 'opened'
runs-on: ubuntu-latest
permissions:
issues: write
models: read
steps:
- name: Run AI inference
id: inference
uses: actions/ai-inference@v2
env:
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_BODY: ${{ github.event.issue.body }}
with:
prompt: |
Summarize the following GitHub issue in one paragraph:
Title: ${{ env.ISSUE_TITLE }}
Body: ${{ env.ISSUE_BODY }}
- name: Upsert guidance comment
uses: actions/github-script@v9
env:
AI_SUMMARY: ${{ steps.inference.outputs.response }}
with:
script: |
const marker = '<!-- enginescript-issue-assistant-comment -->';
const aiSummary = (process.env.AI_SUMMARY || '').trim() || 'Summary unavailable for this issue content.';
const body = `${marker}
Thanks for opening an issue in EngineScript! 🚀
### Quick AI Summary
${aiSummary}
To help us better understand your issue, please run the following command on your server:
\`\`\`bash
es.debug
\`\`\`
This command will generate a detailed report including:
- System information
- Software versions
- Configuration settings
- Service status
- Network information
⚠️ **Important Privacy Note**
Before sharing the debug output, please review and **remove any sensitive information** that you don't want to share publicly. This may include:
- IP addresses
- Hostnames
- Domain names
- Usernames
- Passwords or API keys (though \`es.debug\` tries to avoid these)
The debug report is saved to a file (the path will be shown when the command finishes) and formatted specifically for GitHub.
After reviewing and sanitizing the content, please **edit your original issue description** to include the debug output, or paste it in a new comment below.
We'll review your issue soon!`;
const issue_number = context.payload.issue.number;
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number,
per_page: 100
});
const existingComment = comments.find((comment) =>
comment.user.type === 'Bot' && comment.body && comment.body.includes(marker)
);
if (existingComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number,
body
});
}
manual-issue-guidance:
if: github.event_name == 'workflow_dispatch' && inputs.issue_number != ''
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Post manual guidance comment
uses: peter-evans/create-or-update-comment@v5
with:
issue-number: ${{ inputs.issue_number }}
body: |
<!-- enginescript-issue-assistant-comment -->
Thanks for opening an issue in EngineScript! 🚀
To help us better understand your issue, please run the following command on your server:
```bash
es.debug
```
This command will generate a detailed report including:
- System information
- Software versions
- Configuration settings
- Service status
- Network information
⚠️ **Important Privacy Note**
Before sharing the debug output, please review and **remove any sensitive information** that you don't want to share publicly. This may include:
- IP addresses
- Hostnames
- Domain names
- Usernames
- Passwords or API keys (though `es.debug` tries to avoid these)
The debug report is saved to a file (the path will be shown when the command finishes) and formatted specifically for GitHub.
After reviewing and sanitizing the content, please **edit your original issue description** to include the debug output, or paste it in a new comment below.
We'll review your issue soon!
stale:
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v10
with:
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
days-before-issue-stale: 30
days-before-pr-stale: 45
days-before-issue-close: 5
days-before-pr-close: 10