fix(workflow) Patch opencode bug in GitHub Actions timeout
This commit is contained in:
parent
dd694ece49
commit
509a9699a8
2 changed files with 116 additions and 1 deletions
|
|
@ -18,7 +18,12 @@
|
||||||
"Bash(./tests/test_stuck_loop_detection.sh:*)",
|
"Bash(./tests/test_stuck_loop_detection.sh:*)",
|
||||||
"Bash(git mv:*)",
|
"Bash(git mv:*)",
|
||||||
"WebFetch(domain:about.codecov.io)",
|
"WebFetch(domain:about.codecov.io)",
|
||||||
"WebFetch(domain:github.com)"
|
"WebFetch(domain:github.com)",
|
||||||
|
"Bash(shellcheck:*)",
|
||||||
|
"Bash(timeout 30 bats:*)",
|
||||||
|
"mcp__sequential-thinking__sequentialthinking",
|
||||||
|
"Bash(git fetch:*)",
|
||||||
|
"Bash(npm run test:unit:*)"
|
||||||
],
|
],
|
||||||
"deny": [],
|
"deny": [],
|
||||||
"ask": []
|
"ask": []
|
||||||
|
|
|
||||||
110
.github/workflows/opencode-review.yml
vendored
Normal file
110
.github/workflows/opencode-review.yml
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
name: OpenCode PR Review
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize]
|
||||||
|
# Skip review for documentation and config-only changes
|
||||||
|
# Exclude this workflow file to prevent self-triggering loops
|
||||||
|
paths-ignore:
|
||||||
|
- "**/*.md"
|
||||||
|
- ".github/workflows/opencode-review.yml"
|
||||||
|
- ".gitignore"
|
||||||
|
- "pyproject.toml"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
opencode-review:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10 # Prevent hanging - kill after 10 min
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Calculate total changes
|
||||||
|
id: calc
|
||||||
|
run: |
|
||||||
|
additions=${{ github.event.pull_request.additions }}
|
||||||
|
deletions=${{ github.event.pull_request.deletions }}
|
||||||
|
total=$((additions + deletions))
|
||||||
|
echo "total=$total" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Checkout repository
|
||||||
|
# Only review substantial changes (5+ files OR 20+ lines changed)
|
||||||
|
if: |
|
||||||
|
github.event.pull_request.changed_files >= 5 ||
|
||||||
|
steps.calc.outputs.total >= 20
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Clear git credentials to avoid duplicate auth
|
||||||
|
if: |
|
||||||
|
github.event.pull_request.changed_files >= 5 ||
|
||||||
|
steps.calc.outputs.total >= 20
|
||||||
|
run: |
|
||||||
|
# Clear all GitHub-related git config to prevent auth conflicts
|
||||||
|
git config --global --unset-all http.https://github.com/.extraheader || true
|
||||||
|
git config --local --unset-all http.https://github.com/.extraheader || true
|
||||||
|
git config --global --unset-all credential.helper || true
|
||||||
|
git config --local --unset-all credential.helper || true
|
||||||
|
git config --global --unset-all credential."https://github.com".helper || true
|
||||||
|
git config --local --unset-all credential."https://github.com".helper || true
|
||||||
|
# Remove any credential URLs
|
||||||
|
git config --global --unset-all credential.url || true
|
||||||
|
git config --local --unset-all credential.url || true
|
||||||
|
# Clear any includeIf configs that might add credentials
|
||||||
|
# Note: git config doesn't support wildcards, so we iterate over matching keys
|
||||||
|
# Use case-insensitive grep to catch both "includeIf" and "includeif"
|
||||||
|
for key in $(git config --global --list --name-only 2>/dev/null | grep -i "^includeif\." || true); do
|
||||||
|
git config --global --unset "$key" || true
|
||||||
|
done
|
||||||
|
for key in $(git config --local --list --name-only 2>/dev/null | grep -i "^includeif\." || true); do
|
||||||
|
git config --local --unset "$key" || true
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Run OpenCode PR Review
|
||||||
|
# Only review substantial changes (5+ files OR 20+ lines changed)
|
||||||
|
if: |
|
||||||
|
github.event.pull_request.changed_files >= 5 ||
|
||||||
|
steps.calc.outputs.total >= 20
|
||||||
|
uses: anomalyco/opencode/github@latest
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }}
|
||||||
|
# Pass PR context as environment variables for the review
|
||||||
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||||
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||||
|
PR_BODY: ${{ github.event.pull_request.body }}
|
||||||
|
REPO_NAME: ${{ github.repository }}
|
||||||
|
with:
|
||||||
|
model: zai-coding-plan/glm-4.7
|
||||||
|
use_github_token: true
|
||||||
|
prompt: |
|
||||||
|
You are reviewing PR #${{ github.event.pull_request.number }} in repository ${{ github.repository }}.
|
||||||
|
|
||||||
|
PR TITLE: ${{ github.event.pull_request.title }}
|
||||||
|
|
||||||
|
Please review this pull request and provide feedback on:
|
||||||
|
- Code quality and best practices
|
||||||
|
- Potential bugs or issues
|
||||||
|
- Performance considerations
|
||||||
|
- Security concerns
|
||||||
|
- Test coverage
|
||||||
|
|
||||||
|
IMPORTANT NOTES:
|
||||||
|
- Review the other comments on the pull request - including any prior reviews.
|
||||||
|
- If you are reviewing changes beyond the first creation of the pull request,
|
||||||
|
make sure your comments are consistent with previous reviews.
|
||||||
|
- There's no need to repeat information unless it is critical and not
|
||||||
|
being reflected in comments or code.
|
||||||
|
- Be aware of prior reviews and that new file information may reflect
|
||||||
|
changes because of previous reviews.
|
||||||
|
|
||||||
|
Use the repository's CLAUDE.md for guidance on style and conventions.
|
||||||
|
Be constructive and helpful in your feedback.
|
||||||
|
|
||||||
|
IMPORTANT: Post exactly ONE comment using `gh pr comment`, then STOP.
|
||||||
|
Do not attempt additional actions after posting your review.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue