autopr.yml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. on:
  2. issues:
  3. types: [labeled]
  4. permissions:
  5. contents: write
  6. issues: write
  7. pull-requests: write
  8. jobs:
  9. autopr:
  10. if: ${{ contains( github.event.label.name, 'AutoPR') }}
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Install jq
  14. run: sudo apt-get install jq
  15. - name: Check if label was added by a collaborator
  16. env:
  17. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  18. run: |
  19. is_collaborator=$(curl -s -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github+json" \
  20. "https://api.github.com/repos/${{ github.repository }}/collaborators/${{ github.event.sender.login }}" | jq -r '.message')
  21. if [ "$is_collaborator" == "Not Found" ]; then
  22. echo "Label not added by a collaborator. Skipping action."
  23. exit 78
  24. fi
  25. - name: Checkout
  26. uses: actions/checkout@v2
  27. with:
  28. ref: main
  29. fetch-depth: 1
  30. - name: AutoPR
  31. uses: docker://ghcr.io/irgolic/autopr:latest
  32. env:
  33. OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  34. with:
  35. github_token: ${{ secrets.GITHUB_TOKEN }}