guidelines-check.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 run -m anthropic/claude-sonnet-4-20250514 "A new pull request has been created: '${{ github.event.pull_request.title }}'
  25. PR description:
  26. ${{ github.event.pull_request.body }}
  27. Please check all the code changes in this pull request against the guidelines in AGENTS.md file in this repository.
  28. For each violation you find, create a file comment using the gh CLI. Use this exact format for each violation:
  29. \`\`\`bash
  30. 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]
  31. \`\`\`
  32. When possible, also submit code change suggestions using:
  33. \`\`\`bash
  34. 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
  35. [corrected code here]
  36. ```'
  37. \`\`\`
  38. Only create comments for actual violations. If the code follows all guidelines, don't run any gh commands."