* Post initial acknowledgment comment on new issue
( owner: string, repo: string, issueNumber: number, issueTitle: string, issueBody: string, classification: ClassificationResult, githubToken: string )
| 22 | * Post initial acknowledgment comment on new issue |
| 23 | */ |
| 24 | async function postAcknowledgmentComment( |
| 25 | owner: string, |
| 26 | repo: string, |
| 27 | issueNumber: number, |
| 28 | issueTitle: string, |
| 29 | issueBody: string, |
| 30 | classification: ClassificationResult, |
| 31 | githubToken: string |
| 32 | ): Promise<boolean> { |
| 33 | try { |
| 34 | const client = new Octokit({ auth: githubToken }); |
| 35 | |
| 36 | console.log(`Generating acknowledgment comment for issue #${issueNumber}...`); |
| 37 | |
| 38 | let comment: string; |
| 39 | try { |
| 40 | comment = await generateAcknowledgmentComment( |
| 41 | owner, |
| 42 | repo, |
| 43 | issueNumber, |
| 44 | issueTitle, |
| 45 | issueBody, |
| 46 | classification, |
| 47 | githubToken |
| 48 | ); |
| 49 | } catch (error) { |
| 50 | console.warn("Failed to generate comment with Bedrock, using fallback"); |
| 51 | comment = getFallbackComment(); |
| 52 | } |
| 53 | |
| 54 | console.log(`Posting acknowledgment comment to issue #${issueNumber}`); |
| 55 | |
| 56 | await retryWithBackoff(async () => { |
| 57 | await client.issues.createComment({ |
| 58 | owner, |
| 59 | repo, |
| 60 | issue_number: issueNumber, |
| 61 | body: comment, |
| 62 | }); |
| 63 | }); |
| 64 | |
| 65 | console.log(`Successfully posted acknowledgment comment to issue #${issueNumber}`); |
| 66 | return true; |
| 67 | } catch (error) { |
| 68 | console.error( |
| 69 | `Error posting acknowledgment comment to issue #${issueNumber}:`, |
| 70 | error |
| 71 | ); |
| 72 | return false; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | async function main() { |
| 77 | const summary: WorkflowSummary = { |
no test coverage detected