From fad306c360b6d826b914177f6e3e7ac0b92ca26b Mon Sep 17 00:00:00 2001 From: dbpolito Date: Tue, 14 Apr 2026 16:28:26 -0300 Subject: [PATCH] ci: trigger PR reviews from labeled events - add a labeled pull_request_target trigger so review runs can be requested from the PR itself - remove the separate issue_comment workflow now that label-based review requests are supported - keep the existing automatic review behavior for non-draft same-repo pull requests --- .../workflows/kompass-pr-review-comment.yml | 55 ------------------- .github/workflows/kompass-pr-review.yml | 6 +- 2 files changed, 5 insertions(+), 56 deletions(-) delete mode 100644 .github/workflows/kompass-pr-review-comment.yml diff --git a/.github/workflows/kompass-pr-review-comment.yml b/.github/workflows/kompass-pr-review-comment.yml deleted file mode 100644 index a35fa80..0000000 --- a/.github/workflows/kompass-pr-review-comment.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Kompass PR Review Comment - -on: - issue_comment: - types: [created] - -jobs: - review: - if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/review') && contains(fromJson('["OWNER","MEMBER"]'), github.event.comment.author_association) - runs-on: ubuntu-latest - steps: - - name: Generate GitHub App Token - id: token - uses: actions/create-github-app-token@v1 - with: - app-id: ${{ secrets.KOMPASS_APP_ID }} - private-key: ${{ secrets.KOMPASS_APP_PRIVATE_KEY }} - - - name: Get PR details - id: pr - env: - GH_TOKEN: ${{ steps.token.outputs.token }} - run: | - gh api /repos/${{ github.repository }}/pulls/${{ github.event.issue.number }} > pr_data.json - echo "head_repo=$(jq -r .head.repo.full_name pr_data.json)" >> "$GITHUB_OUTPUT" - echo "head_ref=$(jq -r .head.ref pr_data.json)" >> "$GITHUB_OUTPUT" - - - name: Checkout code - uses: actions/checkout@v4 - with: - repository: ${{ steps.pr.outputs.head_repo }} - ref: ${{ steps.pr.outputs.head_ref }} - fetch-depth: 0 - token: ${{ steps.token.outputs.token }} - - - name: Setup Bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: latest - - - name: Install dependencies - run: bun install - - - name: Install Kompass Tooling - uses: ./.github/actions/kompass-opencode-install - - - name: Run Kompass PR Review - env: - GITHUB_TOKEN: ${{ steps.token.outputs.token }} - OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} - run: opencode run --model="${{ vars.OPENCODE_MODEL }}" --variant="${{ vars.OPENCODE_VARIANT }}" --thinking --command="pr/review" "${{ github.event.issue.number }}" - - - name: Export Kompass Session - if: always() - uses: ./.github/actions/kompass-opencode-session-export diff --git a/.github/workflows/kompass-pr-review.yml b/.github/workflows/kompass-pr-review.yml index 0cf51a6..f4a9c36 100644 --- a/.github/workflows/kompass-pr-review.yml +++ b/.github/workflows/kompass-pr-review.yml @@ -3,10 +3,14 @@ name: Kompass PR Review on: pull_request: types: [opened, synchronize, reopened, ready_for_review] + pull_request_target: + types: [labeled] jobs: review: - if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.repository + if: | + (github.event_name == 'pull_request' && github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.repository) || + (github.event_name == 'pull_request_target' && github.event.pull_request.draft == false && github.event.label.name == 'review') runs-on: ubuntu-latest steps: - name: Generate GitHub App Token