guidelines-check.yml 1.7 KB

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