ChatGPT #95
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ChatGPT | |
on: | |
issue_comment: | |
types: | |
- created | |
jobs: | |
review: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Check Conditions | |
id: check | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Check if the comment contains [gpt review] | |
COMMENT_BODY="${{ github.event.comment.body }}" | |
echo "is_gpt_review=$(if [[ "$COMMENT_BODY" == *"[gpt review]"* ]]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_ENV | |
# Check if the commenter is in the specified group | |
COMMENTER="${{ github.event.comment.user.login }}" | |
IS_IN_GROUP=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
https://api.github.com/orgs/freeverseio/teams/ziggy/members/$COMMENTER) | |
echo "is_in_group=$(if [[ "$IS_IN_GROUP" != "null" ]]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_ENV | |
- name: Review if Correct User, and Gpt Review | |
if: env.is_in_group == 'true' && env.is_gpt_review == 'true' | |
uses: gvasilei/[email protected] | |
env: | |
NODE_OPTIONS: '--experimental-fetch' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
openai_api_key: ${{ secrets.OPENAI_API_KEY }} | |
model_name: gpt-4 |