fix(api): existing issue check

This commit is contained in:
wanhose 2024-08-24 13:36:00 +02:00
parent b8aad0921f
commit e25d18adc9

View File

@ -49,7 +49,8 @@ export default (server: FastifyInstance, _options: RouteShorthandOptions, done:
const existingIssue = existingIssues.data.items[0]; const existingIssue = existingIssues.data.items[0];
try { try {
if (existingIssue?.state === 'closed') { if (existingIssue) {
if (existingIssue.state === 'closed') {
await octokit.request('PATCH /repos/{owner}/{repo}/issues/{issue_number}', { await octokit.request('PATCH /repos/{owner}/{repo}/issues/{issue_number}', {
owner: environment.github.owner, owner: environment.github.owner,
repo: environment.github.repo, repo: environment.github.repo,
@ -57,6 +58,7 @@ export default (server: FastifyInstance, _options: RouteShorthandOptions, done:
labels: ['bug'], labels: ['bug'],
state: 'open', state: 'open',
}); });
}
await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/comments', { await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/comments', {
owner: environment.github.owner, owner: environment.github.owner,