|
| 1 | +name: EvalOpsBot requested review |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [review_requested] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
| 10 | +jobs: |
| 11 | + dispatch: |
| 12 | + if: ${{ github.event.requested_reviewer.login == 'EvalOpsBot' }} |
| 13 | + runs-on: ubuntu-latest |
| 14 | + timeout-minutes: 5 |
| 15 | + env: |
| 16 | + GH_TOKEN: ${{ secrets.EVALOPS_PR_LENS_TOKEN }} |
| 17 | + TARGET_REPO: ${{ github.repository }} |
| 18 | + TARGET_PR: ${{ github.event.pull_request.number }} |
| 19 | + HEAD_SHA: ${{ github.event.pull_request.head.sha }} |
| 20 | + REQUESTED_REVIEWER: ${{ github.event.requested_reviewer.login }} |
| 21 | + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 22 | + steps: |
| 23 | + - name: Require dispatch token |
| 24 | + shell: bash |
| 25 | + run: | |
| 26 | + set -euo pipefail |
| 27 | + if [ -z "${GH_TOKEN}" ]; then |
| 28 | + echo "::error::Set EVALOPS_PR_LENS_TOKEN for immediate EvalOpsBot review dispatch." |
| 29 | + exit 2 |
| 30 | + fi |
| 31 | +
|
| 32 | + - name: Dispatch deep review |
| 33 | + shell: bash |
| 34 | + run: | |
| 35 | + set -euo pipefail |
| 36 | + dispatch_payload="$( |
| 37 | + jq -n \ |
| 38 | + --arg target_repo "${TARGET_REPO}" \ |
| 39 | + --arg target_pr "${TARGET_REPO}#${TARGET_PR}" \ |
| 40 | + --arg requested_reviewer "${REQUESTED_REVIEWER}" \ |
| 41 | + --arg source "repo-review-request-workflow" \ |
| 42 | + --arg requester "${GITHUB_ACTOR}" \ |
| 43 | + '{ |
| 44 | + event_type: "evalopsbot-review-requested", |
| 45 | + client_payload: { |
| 46 | + target_repo: $target_repo, |
| 47 | + target_pr: $target_pr, |
| 48 | + requested_reviewer: $requested_reviewer, |
| 49 | + source: $source, |
| 50 | + requester: $requester |
| 51 | + } |
| 52 | + }' |
| 53 | + )" |
| 54 | + gh api --method POST repos/evalops/.github/dispatches --input - <<<"${dispatch_payload}" |
| 55 | +
|
| 56 | + - name: Mark deep review queued |
| 57 | + shell: bash |
| 58 | + run: | |
| 59 | + set -euo pipefail |
| 60 | + status_payload="$( |
| 61 | + jq -n \ |
| 62 | + --arg state "pending" \ |
| 63 | + --arg context "evalops-pr-lens/meta-review" \ |
| 64 | + --arg description "Queued EvalOpsBot requested deep review" \ |
| 65 | + --arg target_url "${RUN_URL}" \ |
| 66 | + '{ |
| 67 | + state: $state, |
| 68 | + context: $context, |
| 69 | + description: $description, |
| 70 | + target_url: $target_url |
| 71 | + }' |
| 72 | + )" |
| 73 | + gh api --method POST "repos/${TARGET_REPO}/statuses/${HEAD_SHA}" --input - <<<"${status_payload}" |
0 commit comments