Run PR review only for same-repo PRs #110
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize, ready_for_review] | |
| workflow_call: | |
| inputs: | |
| review_prompt: | |
| description: "Review prompt profile to use: connector or general" | |
| required: false | |
| default: connector | |
| type: string | |
| concurrency: | |
| group: pr-review-${{ github.workflow_ref }}-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| pr-review: | |
| if: github.event_name != 'pull_request' || github.repository != 'ConductorOne/github-workflows' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| steps: | |
| - name: Report skipped review | |
| if: github.event.pull_request.head.repo.full_name != github.repository | |
| run: | | |
| echo "Skipped: Claude review only runs on same-repo PRs." | |
| - name: Checkout PR head | |
| if: github.event.pull_request.head.repo.full_name == github.repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| persist-credentials: false | |
| - name: Checkout workflow repo | |
| if: github.event.pull_request.head.repo.full_name == github.repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| repository: ${{ job.workflow_repository }} | |
| ref: ${{ job.workflow_sha }} | |
| path: _workflow | |
| persist-credentials: false | |
| - name: Run PR Review | |
| if: github.event.pull_request.head.repo.full_name == github.repository | |
| uses: ./_workflow/.github/actions/pr-review | |
| with: | |
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| pr_number: ${{ github.event.pull_request.number }} | |
| head_sha: ${{ github.event.pull_request.head.sha }} | |
| review_prompt: ${{ inputs.review_prompt || 'connector' }} | |
| timeout-minutes: 15 |