-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.js
34 lines (28 loc) · 1.07 KB
/
index.js
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
import jira from 'jira.js'
import fs from 'fs'
const Client = jira.Version2Client
const jql = 'project = MC AND resolved > lastRun AND resolution = Fixed AND fixVersion in unreleasedVersions()'
const mojira = new Client({
host: 'https://bugs.mojang.com',
})
const lastRun = fs.readFileSync('./lastRun').toString()
fs.writeFileSync('./lastRun', new Buffer.from(Date.now().toString()))
// https://github.com/mojira/mojira-discord-bot/blob/master/src/tasks/FilterFeedTask.ts
const searchResults = await mojira.issueSearch.searchForIssuesUsingJql({
jql: jql.replace('lastRun', lastRun),
fields: ['key', 'summary'],
})
console.log(searchResults)
if ( !searchResults.issues || searchResults.issues.length === 0 ) {
console.log('No new issues found.')
console.log('::set-output name=new-issue::no')
process.exit(0)
}
const tr = JSON.parse(fs.readFileSync('./en.json').toString())
const added = {}
for (const i of searchResults.issues) {
added[i.key] = i.fields.summary
}
const newTr = Object.assign(added, tr)
console.log(newTr)
fs.writeFileSync('./en.json', JSON.stringify(newTr))