Skip to content

fix: whatever

fix: whatever #43

Workflow file for this run

name: LGTM Review
on:
issue_comment:
types: [created]
jobs:
check-permission:
if: |
github.event.issue.pull_request &&
startsWith(github.event.comment.body, '/lgtm review')
runs-on: ubuntu-latest
outputs:
has-permission: ${{ steps.check.outputs.has-permission }}
steps:
- name: Check if commenter has write access
id: check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
USER=${{ github.event.comment.user.login }}
REPO=${{ github.repository }}
PERMISSION=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/repos/$REPO/collaborators/$USER/permission \
| jq -r '.permission')
if [[ "$PERMISSION" == "admin" || "$PERMISSION" == "maintain" || "$PERMISSION" == "write" ]]; then
echo "has-permission=true" >> $GITHUB_OUTPUT
else
echo "has-permission=false" >> $GITHUB_OUTPUT
fi
lgtm-review:
needs: check-permission
if: needs.check-permission.outputs.has-permission == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout PR code
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/merge
- name: Run LGTM Review
uses: ./
with:
ai-api-key: ${{ secrets.AI_API_TOKEN }}
git-api-key: ${{ secrets.GITHUB_TOKEN }}
pr-number: ${{ github.event.issue.number }}