guidelines-check.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. name: Guidelines Check
  2. on:
  3. pull_request:
  4. types: [opened, synchronize]
  5. jobs:
  6. check-guidelines:
  7. runs-on: ubuntu-latest
  8. permissions:
  9. contents: read
  10. pull-requests: write
  11. steps:
  12. - name: Checkout repository
  13. uses: actions/checkout@v4
  14. with:
  15. fetch-depth: 1
  16. - name: Install opencode
  17. run: curl -fsSL https://opencode.ai/install | bash
  18. - name: Check PR guidelines compliance
  19. env:
  20. ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
  21. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  22. OPENCODE_PERMISSION: '{ "bash": { "gh*": "allow", "*": "deny" } }'
  23. run: |
  24. opencode --print-logs run -m anthropic/claude-sonnet-4-20250514 "A new pull request has been created: '${{ github.event.pull_request.title }}'
  25. <pr-number>
  26. ${{ github.event.pull_request.number }}
  27. </pr-number>
  28. <pr-description>
  29. ${{ github.event.pull_request.body }}
  30. </pr-description>
  31. 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.
  32. For each violation you find, create a file comment using the gh CLI. Use this exact format for each violation:
  33. \`\`\`bash
  34. gh pr review ${{ github.event.pull_request.number }} --comment-body 'This violates the AGENTS.md guideline: [specific rule]. Consider: [suggestion]' --file 'path/to/file.ts' --line [line_number]
  35. \`\`\`
  36. When possible, also submit code change suggestions using:
  37. \`\`\`bash
  38. gh pr review ${{ github.event.pull_request.number }} --comment-body 'Suggested fix for AGENTS.md guideline violation:' --file 'path/to/file.ts' --line [line_number] --body '```suggestion
  39. [corrected code here]
  40. ```'
  41. \`\`\`
  42. Only create comments for actual violations. If the code follows all guidelines, don't run any gh commands."