Skip to content

Commit 1be1fef

Browse files
authored
Add AI triage workflow and LLM documentation (#1577)
- Add GitHub Actions workflow for automated issue triage using AI - Include LLM documentation with labeling guidelines for Java development - Configure workflow for vscode-java-debug repository - Enable automatic labeling and commenting on new issues
1 parent edadda4 commit 1be1fef

File tree

2 files changed

+166
-0
lines changed

2 files changed

+166
-0
lines changed

.github/llms.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Extension Pack for Java
2+
3+
Extension Pack for Java is a collection of popular extensions that can help write, test and debug Java applications in Visual Studio Code. By installing Extension Pack for Java, the following extensions are installed:
4+
5+
- [📦 Language Support for Java™ by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java)
6+
- Code Navigation
7+
- Auto Completion
8+
- Refactoring
9+
- Code Snippets
10+
- [📦 Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug)
11+
- Debugging
12+
- [📦 Test Runner for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test)
13+
- Run & Debug JUnit/TestNG Test Cases
14+
- [📦 Maven for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-maven)
15+
- Project Scaffolding
16+
- Custom Goals
17+
- [📦 Gradle for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-gradle)
18+
- View Gradle tasks and project dependencies
19+
- Gradle file authoring
20+
- Import Gradle projects via [Gradle Build Server](https://github.com/microsoft/build-server-for-gradle)
21+
- [📦 Project Manager for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency)
22+
- Manage Java projects, referenced libraries, resource files, packages, classes, and class members
23+
- [📦 Visual Studio IntelliCode](https://marketplace.visualstudio.com/items?itemName=VisualStudioExptTeam.vscodeintellicode)
24+
- AI-assisted development
25+
- Completion list ranked by AI
26+
27+
## Label
28+
29+
When labeling an issue, follow the rules below per label category:
30+
31+
### General Rules
32+
33+
- Analyze if the issue is related with the scope of using extensions for Java development. If not, STOP labelling IMMEDIATELY.
34+
- Assign label per category.
35+
- If a category is not applicable or you're unsure, you may skip it.
36+
- Do not assign multiple labels within the same category, unless explicitly allowed as an exception.
37+
38+
### Issue Type Labels
39+
40+
- [bug]: Primary label for real bug issues
41+
- [enhancement]: Primary label for enhancement issues
42+
- [documentation]: Primary label for documentation issues
43+
- [question]: Primary label for question issues

.github/workflows/triage-agent.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: AI Triage - Label and Comment on New Issues
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
workflow_dispatch:
7+
inputs:
8+
issue_number:
9+
description: 'Issue number to triage (manual run). e.g. 123'
10+
required: true
11+
12+
permissions:
13+
issues: write
14+
contents: read
15+
16+
jobs:
17+
label_and_comment:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v2
23+
24+
- name: Get issue data
25+
id: get_issue
26+
uses: actions/github-script@v6
27+
with:
28+
script: |
29+
const eventName = context.eventName;
30+
let issue;
31+
if (eventName === 'workflow_dispatch') {
32+
const inputs = context.payload.inputs || {};
33+
const issueNumber = inputs.issue_number || inputs.issueNumber;
34+
if (!issueNumber) core.setFailed('Input issue_number is required for manual run.');
35+
const { data } = await github.rest.issues.get({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
issue_number: parseInt(issueNumber, 10),
39+
});
40+
issue = data;
41+
} else if (context.payload.issue) {
42+
issue = context.payload.issue;
43+
} else {
44+
core.setFailed('No issue information found in the event payload.');
45+
}
46+
core.setOutput('id', String(issue.number));
47+
core.setOutput('user', String((issue.user && issue.user.login) || ''));
48+
core.setOutput('title', String(issue.title || ''));
49+
core.setOutput('body', String(issue.body || ''));
50+
const labelNames = (issue.labels || []).map(label => label.name);
51+
core.setOutput('labels', JSON.stringify(labelNames));
52+
53+
- name: Call Azure Function
54+
id: call_azure_function
55+
env:
56+
PAYLOAD: >-
57+
{
58+
"authToken": "${{ secrets.GITHUB_TOKEN }}",
59+
"repoId": "microsoft/vscode-java-debug",
60+
"issueData": {
61+
"id": ${{ steps.get_issue.outputs.id }},
62+
"user": ${{ toJson(steps.get_issue.outputs.user) }},
63+
"title": ${{ toJson(steps.get_issue.outputs.title) }},
64+
"body": ${{ toJson(steps.get_issue.outputs.body) }},
65+
"labels": ${{ steps.get_issue.outputs.labels }}
66+
},
67+
"mode": "DirectUpdate"
68+
}
69+
70+
run: |
71+
# Make the HTTP request with improved error handling and timeouts
72+
echo "Making request to triage agent..."
73+
74+
# Add timeout handling and better error detection
75+
set +e # Don't exit on curl failure
76+
response=$(timeout ${{ vars.TRIAGE_AGENT_TIMEOUT }} curl \
77+
--max-time 0 \
78+
--connect-timeout 30 \
79+
--fail-with-body \
80+
--silent \
81+
--show-error \
82+
--write-out "HTTPSTATUS:%{http_code}" \
83+
--header "Content-Type: application/json" \
84+
--request POST \
85+
--data "$PAYLOAD" \
86+
${{ secrets.TRIAGE_FUNCTION_LINK }} 2>&1)
87+
88+
curl_exit_code=$?
89+
set -e # Re-enable exit on error
90+
91+
echo "Curl exit code: $curl_exit_code"
92+
93+
# Check if curl command timed out or failed
94+
if [ $curl_exit_code -eq 124 ]; then
95+
echo "❌ Request timed out after 650 seconds"
96+
exit 1
97+
elif [ $curl_exit_code -ne 0 ]; then
98+
echo "❌ Curl command failed with exit code: $curl_exit_code"
99+
echo "Response: $response"
100+
exit 1
101+
fi
102+
103+
# Extract HTTP status code and response body
104+
http_code=$(echo "$response" | grep -o "HTTPSTATUS:[0-9]*" | cut -d: -f2)
105+
response_body=$(echo "$response" | sed 's/HTTPSTATUS:[0-9]*$//')
106+
107+
echo "HTTP Status Code: $http_code"
108+
109+
# Validate HTTP status code
110+
if [ -z "$http_code" ]; then
111+
echo "❌ Failed to extract HTTP status code from response"
112+
echo "Raw response: $response"
113+
exit 1
114+
fi
115+
116+
# Check if the request was successful
117+
if [ "$http_code" -ge 200 ] && [ "$http_code" -lt 300 ]; then
118+
echo "✅ Azure Function call succeeded"
119+
else
120+
echo "❌ Azure Function call failed with status code: $http_code"
121+
echo "Response: $response_body"
122+
exit 1
123+
fi

0 commit comments

Comments
 (0)