duplicate-prs.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. name: Duplicate PR Check
  2. on:
  3. pull_request:
  4. types: [opened]
  5. jobs:
  6. check-duplicates:
  7. if: |
  8. github.event.pull_request.user.login != 'actions-user' &&
  9. github.event.pull_request.user.login != 'opencode' &&
  10. github.event.pull_request.user.login != 'rekram1-node' &&
  11. github.event.pull_request.user.login != 'thdxr' &&
  12. github.event.pull_request.user.login != 'kommander' &&
  13. github.event.pull_request.user.login != 'jayair' &&
  14. github.event.pull_request.user.login != 'fwang' &&
  15. github.event.pull_request.user.login != 'adamdotdevin' &&
  16. github.event.pull_request.user.login != 'iamdavidhill' &&
  17. github.event.pull_request.user.login != 'opencode-agent[bot]'
  18. runs-on: blacksmith-4vcpu-ubuntu-2404
  19. permissions:
  20. contents: read
  21. pull-requests: write
  22. steps:
  23. - name: Checkout repository
  24. uses: actions/checkout@v4
  25. with:
  26. fetch-depth: 1
  27. - name: Setup Bun
  28. uses: ./.github/actions/setup-bun
  29. - name: Install opencode
  30. run: curl -fsSL https://opencode.ai/install | bash
  31. - name: Check for duplicate PRs
  32. env:
  33. OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
  34. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  35. PR_NUMBER: ${{ github.event.pull_request.number }}
  36. PR_TITLE: ${{ github.event.pull_request.title }}
  37. PR_BODY: ${{ github.event.pull_request.body }}
  38. run: |
  39. COMMENT=$(opencode run --agent duplicate-pr --print "Check for duplicate PRs related to this new PR:
  40. Title: $PR_TITLE
  41. Description: $PR_BODY")
  42. gh pr comment "$PR_NUMBER" --body "_The following comment was made by an LLM, it may be inaccurate:_
  43. $COMMENT"