|
| 1 | +# OpenCodeReview PR auto-review — thin caller around the org reusable |
| 2 | +# workflow (fiveonecode/workflows .github/workflows/ocr-reusable.yml). |
| 3 | +# |
| 4 | +# LLM endpoint/key/model come from org-level Actions secrets/variables |
| 5 | +# (OCR_LLM_URL, OCR_LLM_AUTH_TOKEN, OCR_LLM_MODEL, OCR_LLM_USE_ANTHROPIC); |
| 6 | +# repo-level values of the same names override them. |
| 7 | +# |
| 8 | +# The gate mirrors the reusable workflow's intended triggers: automatic |
| 9 | +# review on PR opened/synchronize/reopened, plus on-demand re-review when a |
| 10 | +# human OWNER/MEMBER/COLLABORATOR comments /open-code-review or |
| 11 | +# @open-code-review. Non-matching comments land in a unique noop group so |
| 12 | +# they skip instantly without cancelling a running review. |
| 13 | + |
| 14 | +name: OpenCodeReview PR Review |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: >- |
| 18 | + ${{ |
| 19 | + ( |
| 20 | + github.event_name == 'pull_request_target' |
| 21 | + || ( |
| 22 | + github.event_name == 'issue_comment' |
| 23 | + && github.event.issue.pull_request |
| 24 | + && github.event.comment.user.type != 'Bot' |
| 25 | + && ( |
| 26 | + github.event.comment.author_association == 'MEMBER' |
| 27 | + || github.event.comment.author_association == 'OWNER' |
| 28 | + || github.event.comment.author_association == 'COLLABORATOR' |
| 29 | + ) |
| 30 | + && ( |
| 31 | + startsWith(github.event.comment.body, '/open-code-review') |
| 32 | + || startsWith(github.event.comment.body, '@open-code-review') |
| 33 | + ) |
| 34 | + ) |
| 35 | + ) |
| 36 | + && format('ocr-{0}', github.event.pull_request.number || github.event.issue.number) |
| 37 | + || format('noop-{0}', github.run_id) |
| 38 | + }} |
| 39 | + cancel-in-progress: true |
| 40 | + |
| 41 | +on: |
| 42 | + pull_request_target: |
| 43 | + types: [opened, synchronize, reopened] |
| 44 | + issue_comment: |
| 45 | + types: [created] |
| 46 | + |
| 47 | +permissions: |
| 48 | + contents: read |
| 49 | + pull-requests: write |
| 50 | + |
| 51 | +jobs: |
| 52 | + code-review: |
| 53 | + if: | |
| 54 | + github.event_name == 'pull_request_target' |
| 55 | + || ( |
| 56 | + github.event_name == 'issue_comment' |
| 57 | + && github.event.issue.pull_request |
| 58 | + && github.event.comment.user.type != 'Bot' |
| 59 | + && ( |
| 60 | + github.event.comment.author_association == 'MEMBER' |
| 61 | + || github.event.comment.author_association == 'OWNER' |
| 62 | + || github.event.comment.author_association == 'COLLABORATOR' |
| 63 | + ) |
| 64 | + && ( |
| 65 | + startsWith(github.event.comment.body, '/open-code-review') |
| 66 | + || startsWith(github.event.comment.body, '@open-code-review') |
| 67 | + ) |
| 68 | + ) |
| 69 | + uses: fiveonecode/workflows/.github/workflows/ocr-reusable.yml@main |
| 70 | + secrets: inherit |
0 commit comments