Skip to content

Commit

Permalink
change review result obtaining logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatthan-kim committed Sep 24, 2024
1 parent 96793f0 commit f490920
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,32 +91,20 @@ jobs:
fi
done
- name: Get Batch job results
id: results
- name: Get Review Result from S3
id: get-review
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
RESULTS=$(aws batch describe-jobs --jobs ${{ steps.submit-job.outputs.job_id }} | jq -r '.jobs[0].container.logStreamName')
LOGS=$(aws logs get-log-events --log-group-name /aws/batch/job --log-stream-name $RESULTS | jq -r '.events[].message' | base64 -w 0)
echo "::set-output name=logs::$LOGS"
aws s3 cp s3://llm-code-review-test/review_result/result_${PR_NUMBER}.json result.json
echo "review_result=$(cat result.json)" >> $GITHUB_OUTPUT
- name: Comment PR
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const decodedLogs = Buffer.from('${{ steps.results.outputs.logs }}', 'base64').toString('utf-8');
let review;
const lines = decodedLogs.split('\n');
for (const line of lines) {
try {
review = JSON.parse(line);
break;
} catch (e) {
// JSON이 아닌 라인은 무시
}
}
if (!review) {
throw new Error('로그에서 JSON 출력을 찾을 수 없습니다');
}
const review = JSON.parse('${{ steps.get-review.outputs.review_result }}');
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
Expand Down

0 comments on commit f490920

Please sign in to comment.