Skip to content

Commit

Permalink
🔄 chore(autopr.yml): rename workflow file and update its contents
Browse files Browse the repository at this point in the history
The previous workflow file '.github/workflows/Automatic Pull Request.yml' was deleted and replaced with a new file '.github/workflows/autopr.yml'. The new workflow file listens to the 'labeled' event on issues and checks if the label was added by a collaborator. If the label was added by a collaborator, it runs the 'AutoPR' action using the latest version of the 'ghcr.io/irgolic/autopr' Docker image. The action requires the 'OPENAI_API_KEY' and 'GITHUB_TOKEN' secrets to be set.
  • Loading branch information
lovejavaee committed May 8, 2023
1 parent 3131d8b commit 880c988
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/Automatic Pull Request.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/autopr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on:
issues:
types: [labeled]

permissions:
contents: write
issues: write
pull-requests: write

jobs:
autopr:
if: ${{ contains( github.event.label.name, 'AutoPR') }}
runs-on: ubuntu-latest
steps:
- name: Install jq
run: sudo apt-get install jq
- name: Check if label was added by a collaborator
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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
fi
- name: Checkout
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 1
- name: AutoPR
uses: docker://ghcr.io/irgolic/autopr:latest
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
model: 'gpt-3.5-turbo'
context_limit: 4096

0 comments on commit 880c988

Please sign in to comment.