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 0bb3007
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 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
5 changes: 4 additions & 1 deletion tasks/code-review.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { chat } from 'azion/ai';
// eslint-disable-next-line import/no-unresolved
import * as github from '@actions/github';
import { chat } from 'azion/ai';

/**
*
Expand All @@ -23,8 +23,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,6 +47,7 @@ ${fullContent}
Provide your analysis in Markdown format, starting with a general summary of the pull request.`;

console.log(prompt);
const { data: response, error } = await chat(
{
messages: [{ role: 'user', content: prompt }],
Expand Down

0 comments on commit 0bb3007

Please sign in to comment.