forked from Tradazone/Tradazone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert_issues.js
More file actions
58 lines (44 loc) · 1.69 KB
/
Copy pathconvert_issues.js
File metadata and controls
58 lines (44 loc) · 1.69 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
import fs from 'fs';
const content = fs.readFileSync('tradazone_audit_issues.md', 'utf-8');
const blocks = content.split('---').filter(b => b.trim().includes('### Issue #'));
console.log(`Found ${blocks.length} issues to parse.`);
const categoryToLabel = {
'Bug/Edge Case': 'bug',
'UI/UX': 'enhancement',
'Performance & Scalability': 'performance',
'Security & Compliance': 'security',
'Feature Enhancement': 'enhancement',
'Testing & QA': 'testing',
'DevOps & Infrastructure': 'devops',
'Documentation': 'documentation'
};
const issues = [];
for (let i = 0; i < blocks.length; i++) {
const block = blocks[i];
const titleMatch = block.match(/### Issue #\d+: (.+)/);
if (!titleMatch) continue;
let title = titleMatch[1].trim();
let body = block.replace(/### Issue #\d+: (.+)\n+/, '').trim();
const catMatch = block.match(/\*\*Category:\*\* (.+)/);
let categoryLabel = 'task';
if (catMatch) {
const rawCat = catMatch[1].trim();
categoryLabel = categoryToLabel[rawCat] || 'task';
}
const priorityMatch = block.match(/\*\*Priority:\*\* (.+)/);
let priorityLabel = priorityMatch ? `Priority: ${priorityMatch[1].trim()}` : null;
const areaMatch = block.match(/\*\*Affected Area:\*\* (.+)/);
let areaLabel = areaMatch ? `Area: ${areaMatch[1].trim()}` : null;
const labels = [categoryLabel];
if (priorityLabel) labels.push(priorityLabel);
if (areaLabel) labels.push(areaLabel);
// Add universal label requested by user
labels.push("Stellar wave");
issues.push({
title,
body,
labels
});
}
fs.writeFileSync('issues.json', JSON.stringify(issues, null, 2));
console.log(`Successfully generated issues.json with ${issues.length} issues.`);