Input - closes #297 #73
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: PR Comment Create | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
pr_comment_handler: | |
if: github.event.issue.pull_request && (contains(github.event.comment.body, 'gpt3') || contains(github.event.comment.body, 'gpt-3')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set Env Vars | |
id: setup | |
run: | | |
COMPONENT_NAME=$(echo "${{ github.event.issue.title }}" | sed -E 's/^([a-zA-Z_$][0-9a-zA-Z_$]*).*/\1/') | |
echo "COMPONENT_NAME=$COMPONENT_NAME" >> $GITHUB_OUTPUT | |
TICKET_NUMBER=$(echo "${{ github.event.issue.title }}" | sed -n 's/.*#\([0-9]\+\).*/\1/p') | |
echo "TICKET_NUMBER=$TICKET_NUMBER" >> $GITHUB_OUTPUT | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: "issue-${{ steps.setup.outputs.TICKET_NUMBER }}-update" | |
- name: Update Component based on comment (GPT 3.5 Turbo) | |
uses: ./.github/actions/pull-request-comment | |
id: code_gen | |
with: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
COMMENT_BODY: ${{ github.event.comment.body }} | |
COMPONENT_NAME: ${{ steps.setup.outputs.COMPONENT_NAME }} | |
LLM_MODEL: "gpt-3.5-turbo-0613" | |
- name: Update file in git | |
run: | | |
npx prettier --write src/components/atoms | |
git config user.email "brettlamy@gmail.com" | |
git config user.name "Brett Lamy" | |
git add src/components/atoms | |
git commit -m "${{ steps.setup.outputs.COMPONENT_NAME }} - closes #${{ github.event.issue.number }}" | |
git push origin issue-${{ steps.setup.outputs.TICKET_NUMBER }}-update |