diff --git a/.github/workflows/code-review.yml b/.github/workflows/code-review.yml index 5e1e9332..397e9665 100644 --- a/.github/workflows/code-review.yml +++ b/.github/workflows/code-review.yml @@ -31,8 +31,8 @@ jobs: - name: Run Azion AI Code Review env: - GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }} - AZION_TOKEN: ${{ secrets.AZION_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + AZION_TOKEN: ${{ secrets.CUSTOM_AZION_TOKEN }} run: | node tasks/code-review.js continue-on-error: true diff --git a/tasks/code-review.js b/tasks/code-review.js index 7a2f4f5c..c419b207 100644 --- a/tasks/code-review.js +++ b/tasks/code-review.js @@ -1,7 +1,10 @@ -import { chat } from 'azion/ai'; // eslint-disable-next-line import/no-unresolved import * as github from '@actions/github'; +import { createClient } from 'azion/ai'; +const client = createClient({ + token: 'azionff06c3e505508176b914db92bb7c3305e6a', +}); /** * */ @@ -23,8 +26,10 @@ async function runCodeReview() { }); let fullContent = ''; + // eslint-disable-next-line no-restricted-syntax for (const file of files) { if (file.status !== 'removed') { + // eslint-disable-next-line no-await-in-loop const { data: content } = await octokit.rest.repos.getContent({ owner: context.repo.owner, repo: context.repo.repo, @@ -45,7 +50,7 @@ ${fullContent} Provide your analysis in Markdown format, starting with a general summary of the pull request.`; - const { data: response, error } = await chat( + const { data: response, error } = await client.chat( { messages: [{ role: 'user', content: prompt }], },