Skip to content

Commit 72fbdc9

Browse files
committed
suggested edits
1 parent fe9fbae commit 72fbdc9

2 files changed

Lines changed: 19 additions & 51 deletions

File tree

.github/workflows/ai-on-demand.yaml

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: AI On-Demand Assistant
2+
description: "Provides AI assistance when @efp-dev-ops is mentioned by authorized users"
23
on:
34
issue_comment:
45
types: [created]
@@ -18,21 +19,18 @@ jobs:
1819
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@efp-dev-ops')) ||
1920
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@efp-dev-ops')) ||
2021
(github.event_name == 'issues' && contains(github.event.issue.body, '@efp-dev-ops'))
21-
) && (
22-
github.actor == '0xthrpw' ||
23-
github.actor == 'encrypteddegen' ||
24-
github.actor == 'caveman-eth' ||
25-
github.actor == 'brantlymillegan'
26-
)
22+
) && contains(fromJSON(vars.ALLOWED_USER_LIST), github.actor)
2723
runs-on: ubuntu-latest
2824
permissions:
2925
contents: read
3026
issues: write
3127
pull-requests: write
3228

3329
steps:
34-
- name: Checkout code
30+
- name: Checkout Code
3531
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 1
3634

3735
- name: Generate Custom App Token
3836
id: generate-token
@@ -41,7 +39,7 @@ jobs:
4139
app-id: ${{ secrets.APP_ID }}
4240
private-key: ${{ secrets.PRIVATE_KEY }}
4341

44-
- name: Extract instruction from comment
42+
- name: Extract Instruction from Comment
4543
id: extract-instruction
4644
run: |
4745
# Get the comment body based on event type
@@ -60,6 +58,12 @@ jobs:
6058
# Remove the @mention and get the instruction
6159
INSTRUCTION=$(echo "$COMMENT_BODY" | sed 's/@efp-dev-ops[[:space:]]*//' | sed 's/^[[:space:]]*//')
6260
61+
# Add input validation
62+
if [ ${#INSTRUCTION} -gt 4000 ]; then
63+
echo "Instruction too long, truncating..."
64+
INSTRUCTION=$(echo "$INSTRUCTION" | head -c 4000)
65+
fi
66+
6367
# Set as output for next step
6468
echo "instruction<<EOF" >> $GITHUB_OUTPUT
6569
echo "$INSTRUCTION" >> $GITHUB_OUTPUT
@@ -69,6 +73,8 @@ jobs:
6973
7074
- name: AI Response
7175
uses: anthropics/claude-code-action@v0
76+
continue-on-error: true
77+
timeout-minutes: 10
7278
with:
7379
# anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
7480
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
@@ -81,22 +87,3 @@ jobs:
8187
Please provide a helpful, accurate response. If the request involves code analysis, focus on the current repository context. If it's a general question, provide clear and actionable guidance.
8288
8389
Keep your response concise but thorough, and format it nicely for GitHub comments.
84-
85-
# - name: React to original comment
86-
# run: |
87-
# # Add a reaction to show the app "saw" the mention
88-
# if [ "${{ github.event_name }}" = "issue_comment" ] || [ "${{ github.event_name }}" = "pull_request_review_comment" ]; then
89-
# gh api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions \
90-
# --method POST \
91-
# --field content="+1"
92-
# elif [ "${{ github.event_name }}" = "pull_request_review" ]; then
93-
# gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews/${{ github.event.review.id }}/reactions \
94-
# --method POST \
95-
# --field content="+1"
96-
# elif [ "${{ github.event_name }}" = "issues" ]; then
97-
# gh api repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/reactions \
98-
# --method POST \
99-
# --field content="+1"
100-
# fi
101-
env:
102-
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}

.github/workflows/ai-review.yaml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Custom AI Code Review
2+
description: "Automated code quality and documentation review on pull requests"
23
on:
34
pull_request:
45
types: [opened, synchronize, reopened]
@@ -14,7 +15,7 @@ jobs:
1415
issues: write
1516

1617
steps:
17-
- name: Checkout code
18+
- name: Checkout Code
1819
uses: actions/checkout@v4
1920
with:
2021
fetch-depth: 0 # Get full history for better context
@@ -26,31 +27,10 @@ jobs:
2627
app-id: ${{ secrets.APP_ID }}
2728
private-key: ${{ secrets.PRIVATE_KEY }}
2829

29-
# - name: AI Security Review
30-
# uses: anthropics/claude-code-action@v0
31-
# with:
32-
# # anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
33-
# claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
34-
# github_token: ${{ steps.generate-token.outputs.token }}
35-
# direct_prompt: |
36-
# You are the AI security reviewer for our organization.
37-
38-
# Please analyze this pull request for:
39-
# 🛡️ **Security Vulnerabilities**
40-
# - SQL injection risks
41-
# - XSS vulnerabilities
42-
# - Authentication/authorization issues
43-
# - Input validation problems
44-
45-
# 📋 **Compliance Check**
46-
# - Follows our security coding standards
47-
# - Proper error handling
48-
# - Secure configuration practices
49-
50-
# Please provide specific, actionable feedback with line numbers where applicable.
51-
5230
- name: AI Code Quality Review
5331
uses: anthropics/claude-code-action@v0
32+
continue-on-error: true
33+
timeout-minutes: 10
5434
with:
5535
# anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
5636
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
@@ -79,6 +59,7 @@ jobs:
7959
Format your response as a professional code review.
8060
8161
- name: Post Summary Comment
62+
continue-on-error: true
8263
run: |
8364
gh pr comment ${{ github.event.number }} --body "
8465
## 🤖 AI Code Review Complete

0 commit comments

Comments
 (0)