guidelines-check.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. name: Guidelines Check
  2. on:
  3. pull_request_target:
  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-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. Make it clear the suggestions are merely suggestions and the human can decide what to do
  32. For each violation you find, create a file comment using the following command EXACTLY as shown:
  33. ```
  34. gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/comments -f body='[description of problem]' -f path='[path-to-file]' -f line=[line-number] -f side='RIGHT'
  35. ```
  36. If you have a suggestion for how to fix the problem the body can include a suggestion:
  37. ```
  38. \`\`\`suggestion
  39. [suggested code here]
  40. \`\`\`
  41. ```
  42. Only create comments for actual violations. If the code follows all guidelines, don't run any gh commands."