-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (68 loc) · 2.79 KB
/
test-triagerx.yml
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
name: Testing Triager
run-name: Triager Tester in GitHub Actions
on:
issues:
types: [opened]
jobs:
triager_test:
name: Triager Test
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: npm install axios
- name: Collect 10 random closed issues from OpenJ9
uses: actions/github-script@v4
with:
script: |
const axios = require('axios');
let issues = [];
const owner = "eclipse-openj9";
const repo = "openj9";
closed_issues_collected = 0;
function getRandomInt(min, max) {
const minCeiled = Math.ceil(min);
const maxFloored = Math.floor(max);
return Math.floor(Math.random() * (maxFloored - minCeiled) + minCeiled);
}
while (closed_issues_collected < 10) {
const issue_number = getRandomInt(2, 19658);
const { data } = await github.issues.get({
owner,
repo,
issue_number
});
if (data.state === "closed" && data.assignee != null && data.labels.length != 0) {
issues.push(data);
closed_issues_collected++;
}
}
modelOutputs = [];
for (let i = 0; i < issues.length; i++) {
let issue = issues[i];
let input = {
"issue_title": issue["title"],
"issue_description": issue["body"],
}
const response = await axios.post('http://140.211.168.122/recommendation', JSON.stringify(input), {
headers: {
'accept': 'application/json',
'Content-Type': 'application/json',
},
});
modelOutputs.push(response.data);
}
resultString = '';
for (let i = 0; i < issues.length; i++) {
actualLabels = issues[i]["labels"].map(label => label["name"]);
actualAssignees = issues[i]["assignees"].map(assignee => assignee["login"]);
predictedLabels = modelOutputs[i].recommended_components;
predictedAssignees = modelOutputs[i].recommended_developers;
resultString += `Actual Components: ${actualLabels.join(', ')}\Recommended Components: ${predictedLabels.join(', ')}\n`;
resultString += `Actual Assignees: ${actualAssignees.join(', ')}\nRecommended Assignees: ${predictedAssignees.join(', ')}\n\n`;
}
await github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: resultString
});