( owner: string, repo: string, content: string | null, fileUsed: string, docsPath: string, docsBranch: string, env: Env, )
| 298 | } |
| 299 | |
| 300 | async function enqueueDocumentationProcessing( |
| 301 | owner: string, |
| 302 | repo: string, |
| 303 | content: string | null, |
| 304 | fileUsed: string, |
| 305 | docsPath: string, |
| 306 | docsBranch: string, |
| 307 | env: Env, |
| 308 | ) { |
| 309 | try { |
| 310 | if (env.MY_QUEUE) { |
| 311 | console.log("Enqueuing documentation processing", owner, repo); |
| 312 | const repoUrl = `https://github.com/${owner}/${repo}`; |
| 313 | |
| 314 | // Prepare and send message to queue |
| 315 | const message = { |
| 316 | owner, |
| 317 | repo, |
| 318 | repo_url: repoUrl, |
| 319 | file_url: docsPath, |
| 320 | content_length: content?.length, |
| 321 | file_used: fileUsed, |
| 322 | docs_branch: docsBranch, |
| 323 | }; |
| 324 | |
| 325 | await env.MY_QUEUE.send(JSON.stringify(message)); |
| 326 | console.log( |
| 327 | `Queued documentation processing for ${owner}/${repo}`, |
| 328 | message, |
| 329 | ); |
| 330 | } else { |
| 331 | console.error("Queue 'MY_QUEUE' not available in environment"); |
| 332 | } |
| 333 | } catch (error) { |
| 334 | console.error( |
| 335 | `Failed to enqueue documentation request for ${owner}/${repo}`, |
| 336 | error, |
| 337 | ); |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | export async function searchRepositoryDocumentation({ |
| 342 | repoData, |
no test coverage detected