Skip to content

Commit

Permalink
Update autopr.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
caffeinum authored Jun 7, 2023
1 parent 6aa9a3e commit b167094
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/autopr.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
on:
issues:
types: [labeled]
issue_comment:
types: [created]

permissions:
contents: write
Expand All @@ -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
Expand All @@ -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
Expand All @@ -35,4 +42,5 @@ jobs:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
model: gpt-4

0 comments on commit b167094

Please sign in to comment.