| 225 | }) |
| 226 | } |
| 227 | getIssueByLabels () { |
| 228 | const { owner, repo, id, labels, clientID, clientSecret } = this.options |
| 229 | |
| 230 | return axiosGithub.get(`/repos/${owner}/${repo}/issues`, { |
| 231 | auth: { |
| 232 | username: clientID, |
| 233 | password: clientSecret |
| 234 | }, |
| 235 | params: { |
| 236 | labels: labels.concat(id).join(','), |
| 237 | t: Date.now() |
| 238 | } |
| 239 | }).then(res => { |
| 240 | const { createIssueManually } = this.options |
| 241 | let isNoInit = false |
| 242 | let issue = null |
| 243 | if (!(res && res.data && res.data.length)) { |
| 244 | if (!createIssueManually && this.isAdmin) { |
| 245 | return this.createIssue() |
| 246 | } |
| 247 | |
| 248 | isNoInit = true |
| 249 | } else { |
| 250 | issue = res.data[0] |
| 251 | } |
| 252 | this.setState({ issue, isNoInit }) |
| 253 | return issue |
| 254 | }) |
| 255 | } |
| 256 | getIssue () { |
| 257 | const { number } = this.options |
| 258 | const { issue } = this.state |