|
17 | 17 |
|
18 | 18 | const helpers = require("./helpers.js");
|
19 | 19 |
|
20 |
| -/** |
21 |
| - * Performs checks on the JIRA Issue: |
22 |
| - * - The issue is started in JIRA. |
23 |
| - * - The issue contains components. |
24 |
| - * |
25 |
| - * @param {Object} github |
26 |
| - * @param {Object} context |
27 |
| - * @param {String} pullRequestNumber |
28 |
| - * @param {String} jiraID |
29 |
| - */ |
30 |
| -async function verifyJIRAIssue(github, context, pullRequestNumber, jiraID) { |
31 |
| - const ticketInfo = await helpers.getJiraInfo(jiraID); |
32 |
| - if(!ticketInfo["fields"]["components"].length) { |
33 |
| - await commentMissingComponents(github, context, pullRequestNumber); |
34 |
| - } |
35 |
| - |
36 |
| - if(ticketInfo["fields"]["status"]["id"] == 1) { |
37 |
| - // "status": {"name":"Open","id":"1" |
38 |
| - // "description":"The issue is open and ready for the assignee to start work on it.", |
39 |
| - await commentNotStartedTicket(github, context, pullRequestNumber); |
40 |
| - } |
41 |
| -} |
42 |
| - |
43 |
| -/** |
44 |
| - * Adds a comment to add components on the JIRA ticket. |
45 |
| - * |
46 |
| - * @param {Object} github |
47 |
| - * @param {Object} context |
48 |
| - * @param {String} pullRequestNumber |
49 |
| - */ |
50 |
| -async function commentMissingComponents(github, context, pullRequestNumber) { |
51 |
| - const {data: comments} = await github.rest.issues.listComments({ |
52 |
| - owner: context.repo.owner, |
53 |
| - repo: context.repo.repo, |
54 |
| - issue_number: pullRequestNumber, |
55 |
| - per_page: 100 |
56 |
| - }); |
57 |
| - |
58 |
| - var found = false; |
59 |
| - for(var i=0; i<comments.length; i++) { |
60 |
| - if (comments[i].body.includes("has no components in JIRA")) { |
61 |
| - found = true; |
62 |
| - } |
63 |
| - } |
64 |
| - if (!found) { |
65 |
| - await github.rest.issues.createComment({ |
66 |
| - owner: context.repo.owner, |
67 |
| - repo: context.repo.repo, |
68 |
| - issue_number: pullRequestNumber, |
69 |
| - body: ":warning: Ticket **has no components in JIRA**, make sure you assign one." |
70 |
| - }); |
71 |
| - } |
72 |
| -} |
73 |
| - |
74 |
| -/** |
75 |
| - * Adds a comment to start the ticket in JIRA. |
76 |
| - * |
77 |
| - * @param {Object} github |
78 |
| - * @param {Object} context |
79 |
| - * @param {String} pullRequestNumber |
80 |
| - */ |
81 |
| -async function commentNotStartedTicket(github, context, pullRequestNumber) { |
82 |
| - const {data: comments} = await github.rest.issues.listComments({ |
83 |
| - owner: context.repo.owner, |
84 |
| - repo: context.repo.repo, |
85 |
| - issue_number: pullRequestNumber, |
86 |
| - per_page: 100 |
87 |
| - }); |
88 |
| - |
89 |
| - var found = false; |
90 |
| - for(var i=0; i<comments.length; i++) { |
91 |
| - if (comments[i].body.includes("has not been started in JIRA")) { |
92 |
| - found = true; |
93 |
| - } |
94 |
| - } |
95 |
| - if (!found) { |
96 |
| - await github.rest.issues.createComment({ |
97 |
| - owner: context.repo.owner, |
98 |
| - repo: context.repo.repo, |
99 |
| - issue_number: pullRequestNumber, |
100 |
| - body: ":warning: Ticket **has not been started in JIRA**, please click 'Start Progress'." |
101 |
| - }); |
102 |
| - } |
103 |
| -} |
104 |
| - |
105 | 20 | /**
|
106 | 21 | * Assigns the GitHub Issue to the PR creator.
|
107 | 22 | *
|
@@ -164,10 +79,6 @@ module.exports = async ({github, context}) => {
|
164 | 79 | const title = context.payload.pull_request.title;
|
165 | 80 | const issue = helpers.detectIssue(title)
|
166 | 81 | if (issue){
|
167 |
| - if (issue.kind == "jira") { |
168 |
| - await verifyJIRAIssue(github, context, pullRequestNumber, issue.id); |
169 |
| - } else if(issue.kind == "github") { |
170 |
| - await verifyGitHubIssue(github, context, pullRequestNumber, issue.id); |
171 |
| - } |
| 82 | + await verifyGitHubIssue(github, context, pullRequestNumber, issue.id); |
172 | 83 | }
|
173 | 84 | };
|
0 commit comments