Skip to content

Commit 80e0412

Browse files
authored
Merge pull request #1 from devops-0001/compose
compose
2 parents 727f313 + aa0fdaa commit 80e0412

2 files changed

Lines changed: 137 additions & 0 deletions

File tree

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Goose AI PR Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, labeled]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
issues: write
12+
13+
env:
14+
PROVIDER_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
15+
PR_NUMBER: ${{ github.event.pull_request.number }}
16+
GH_TOKEN: ${{ github.token }}
17+
18+
jobs:
19+
goose-comment:
20+
name: Goose Comment
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Check out repository
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Gather PR information
29+
run: |
30+
{
31+
echo "# Files Changed"
32+
gh pr view "$PR_NUMBER" --json files \
33+
-q '.files[] | "* " + .path + " (" + (.additions|tostring) + " additions, " + (.deletions|tostring) + " deletions)"'
34+
echo ""
35+
echo "# Changes Summary"
36+
gh pr diff "$PR_NUMBER"
37+
} > changes.txt
38+
39+
- name: Install Goose CLI
40+
run: |
41+
mkdir -p /home/runner/.local/bin
42+
curl -fsSL https://github.com/block/goose/releases/download/stable/download_cli.sh \
43+
| CONFIGURE=false INSTALL_PATH=/home/runner/.local/bin bash
44+
echo "/home/runner/.local/bin" >> "$GITHUB_PATH"
45+
46+
- name: Configure Goose
47+
run: |
48+
mkdir -p ~/.config/goose
49+
cat > ~/.config/goose/config.yaml <<'EOF'
50+
GOOSE_PROVIDER: google
51+
GOOSE_MODEL: gemini-2.0-flash-exp
52+
keyring: false
53+
EOF
54+
55+
- name: Prepare review instructions
56+
run: |
57+
# Read custom instructions from repository
58+
cat .goose/instructions.txt > review_instructions.txt
59+
echo "" >> review_instructions.txt
60+
echo "The changes to review are:" >> review_instructions.txt
61+
cat changes.txt >> review_instructions.txt
62+
63+
- name: Run Goose AI review
64+
env:
65+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
66+
run: |
67+
goose run --instructions review_instructions.txt \
68+
| sed -E 's/\x1B\[[0-9;]*[mK]//g' \
69+
| grep -v "logging to /home/runner/.config/goose/sessions/" \
70+
| grep -v "^starting session" \
71+
| grep -v "^Closing session" \
72+
| sed 's/[[:space:]]*$//' \
73+
> pr_comment.txt
74+
75+
- name: Post AI review to PR
76+
run: |
77+
{
78+
echo "## 🤖 AI Code Review"
79+
echo "*Automated review by Goose + Google Gemini*"
80+
echo ""
81+
cat pr_comment.txt
82+
echo ""
83+
echo "---"
84+
echo "*This review was automatically generated. Use human judgment for final decisions.*"
85+
} > final_comment.txt
86+
87+
gh pr comment "$PR_NUMBER" --body-file final_comment.txt

.goose/instructions.txt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
You are an expert DevOps engineer reviewing code changes for a machine learning application.
2+
3+
Focus your review on these key areas:
4+
5+
## 🐳 Docker & Containerization
6+
- Dockerfile best practices and optimization
7+
- Multi-stage builds and layer efficiency
8+
- Security considerations (non-root users, minimal base images)
9+
- Health checks and restart policies
10+
11+
## 🏗️ Infrastructure & Orchestration
12+
- Docker Compose service configuration
13+
- Service dependencies and networking
14+
- Volume mounts and data persistence
15+
- Load balancing and proxy setup
16+
17+
## 🔒 Security & Best Practices
18+
- Exposed ports and network security
19+
- Environment variable management
20+
- Container security practices
21+
- Access controls and permissions
22+
23+
## 🚀 CI/CD & Automation
24+
- Workflow efficiency and optimization
25+
- Security scanning integration
26+
- Caching strategies and performance
27+
- Error handling and reliability
28+
29+
## 📊 Code Quality
30+
- Configuration file structure and clarity
31+
- Documentation and maintainability
32+
- Production readiness
33+
- Scalability considerations
34+
35+
## Review Format
36+
Please structure your review as:
37+
38+
**`filename`**
39+
- Summary of changes
40+
- Key observations
41+
- Recommendations for improvement
42+
- Security or performance notes
43+
44+
**Overall Assessment:**
45+
- Rate: Excellent/Good/Needs Improvement
46+
- Main strengths
47+
- Priority improvements
48+
- Production readiness assessment
49+
50+
Keep feedback constructive, specific, and actionable.

0 commit comments

Comments
 (0)