mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-24 11:14:23 +01:00
51 lines
1.8 KiB
YAML
51 lines
1.8 KiB
YAML
name: Guidelines Check
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [opened, synchronize]
|
|
|
|
jobs:
|
|
check-guidelines:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Install opencode
|
|
run: curl -fsSL https://opencode.ai/install | bash
|
|
|
|
- name: Check PR guidelines compliance
|
|
env:
|
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
OPENCODE_PERMISSION: '{ "bash": { "gh*": "allow", "*": "deny" } }'
|
|
run: |
|
|
opencode run -m anthropic/claude-sonnet-4-20250514 "A new pull request has been created: '${{ github.event.pull_request.title }}'
|
|
|
|
<pr-number>
|
|
${{ github.event.pull_request.number }}
|
|
</pr-number>
|
|
|
|
<pr-description>
|
|
${{ github.event.pull_request.body }}
|
|
</pr-description>
|
|
|
|
Please check all the code changes in this pull request against the guidelines in AGENTS.md file in this repository. Diffs are important but make sure you read the entire file to get proper context.
|
|
|
|
For each violation you find, create a file comment using the gh CLI with the suggested fix.
|
|
|
|
\`\`\`bash
|
|
gh pr review ${{ github.event.pull_request.number }} --comment-body '[description-of-problem]' --file 'path/to/file.ts' --line [line_number] --body '```suggestion
|
|
[corrected code here]
|
|
```'
|
|
\`\`\`
|
|
|
|
If you do not have a fix you can just lave a comment without the suggestion.
|
|
|
|
Only create comments for actual violations. If the code follows all guidelines, don't run any gh commands."
|