ci: trigger PR reviews from review label #2
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
| 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 |