Skip to content

Commit

Permalink
ci: use azion/ai client
Browse files Browse the repository at this point in the history
  • Loading branch information
jotanarciso committed Oct 21, 2024
1 parent 60a3a37 commit 7ca7e37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions tasks/code-review.js
Original file line number Diff line number Diff line change
@@ -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',
});
/**
*
*/
Expand All @@ -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,
Expand All @@ -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 }],
},
Expand Down

0 comments on commit 7ca7e37

Please sign in to comment.