From b167094a5f33183e2366420caa919849d66f39ae Mon Sep 17 00:00:00 2001 From: Aleksey Bykhun Date: Wed, 7 Jun 2023 14:58:10 -0400 Subject: [PATCH] Update autopr.yml --- .github/workflows/autopr.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/autopr.yml b/.github/workflows/autopr.yml index 99b43abd..c0832fa3 100644 --- a/.github/workflows/autopr.yml +++ b/.github/workflows/autopr.yml @@ -1,6 +1,8 @@ on: issues: types: [labeled] + issue_comment: + types: [created] permissions: contents: write @@ -9,7 +11,11 @@ permissions: jobs: autopr: - if: ${{ contains( github.event.label.name, 'AutoPR') }} + if: ${{ (github.event_name == 'issues' && + contains( github.event.label.name, 'AutoPR')) || + (github.event_name == 'issue_comment' && + github.event.issue.pull_request && + contains( github.event.comment.body, 'Hey AutoPR')) }} runs-on: ubuntu-latest steps: - name: Install jq @@ -20,6 +26,7 @@ jobs: run: | is_collaborator=$(curl -s -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github+json" \ "https://api.github.com/repos/${{ github.repository }}/collaborators/${{ github.event.sender.login }}" | jq -r '.message') + if [ "$is_collaborator" == "Not Found" ]; then echo "Label not added by a collaborator. Skipping action." exit 78 @@ -35,4 +42,5 @@ jobs: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} with: github_token: ${{ secrets.GITHUB_TOKEN }} + model: gpt-4