-
Notifications
You must be signed in to change notification settings - Fork 0
/
jira.js
29 lines (26 loc) · 864 Bytes
/
jira.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
'use strict';
const JiraApi = require('jira-client');
const jira = new JiraApi({
protocol : 'https',
host: 'jira.bmcs.es',
username: '******',
password: '******',
apiVersion: '2',
strictSSL: true
});
let issueITId = -1;
let issueNetComId = -1;
jira.findIssue("IT-3")
.then(issueIT => issueITId = issueIT.id)
.then(dump => jira.findIssue("NET-78"))
.then(issue => issueNetComId = issue.id)
.then(issueId => jira.getIssueWorklogs(issueId))
.then(data => {
data.worklogs.filter(c => c.comment.toLowerCase().indexOf("retrospectiva") > -1).forEach(wk => {
wk.timeSpentSeconds = null;
jira.addWorklog(issueITId, wk) //por defecto se tiene el ajuste auto
.then(response => jira.deleteWorklog(issueNetComId, wk.id))
.catch(error => console.log(error));
});
})
.catch(error => console.log(error));