File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed
Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ name : LGTM Review
2+
3+ on :
4+ issue_comment :
5+ types : [created]
6+
7+ jobs :
8+ lgtm-review :
9+ if : |
10+ github.event.issue.pull_request &&
11+ startsWith(github.event.comment.body, '/lgtm review')
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Check if commenter has write access
15+ id : check-permission
16+ env :
17+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
18+ run : |
19+ USER=${{ github.event.comment.user.login }}
20+ REPO=${{ github.repository }}
21+ PERMISSION=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
22+ https://api.github.com/repos/$REPO/collaborators/$USER/permission \
23+ | jq -r '.permission')
24+
25+
26+ if [[ "$PERMISSION" == "admin" || "$PERMISSION" == "maintain" || "$PERMISSION" == "write" ]]; then
27+ echo "HAS_PERMISSION=true" >> $GITHUB_ENV
28+ else
29+ echo "HAS_PERMISSION=false" >> $GITHUB_ENV
30+ fi
31+
32+ - name : Fail if unauthorized
33+ if : env.HAS_PERMISSION == 'false'
34+ run : |
35+ echo "User ${{ github.event.comment.user.login }} is not authorized to trigger this workflow."
36+ exit 1
37+
38+ - name : Checkout PR code
39+ uses : actions/checkout@v4
40+ with :
41+ ref : refs/pull/${{ github.event.issue.number }}/merge
42+
43+ - name : Run LGTM Review
44+ run : |
45+ docker run --rm elementsinteractive/lgtm-ai \
46+ review \
47+ --pr-url "https://github.com/${{ github.repository }}/pull/${{ github.event.issue.number }}" \
48+ --git-api-key "${{ secrets.GITHUB_TOKEN }}" \
49+ --ai-api-key "${{ secrets.AI_API_TOKEN }}" \
50+ -vv
Original file line number Diff line number Diff line change 1+ technologies = [" Golang" ]
2+ categories = [" Correctness" , " Quality" , " Testing" , " Security" ]
3+ exclude = [" go.mod" , " go.sum" ]
4+ model = " gemini-2.5-flash-preview-*"
5+ silent = false
6+ publish = true
7+ ai_retries = 2
You can’t perform that action at this time.
0 commit comments