|
| 1 | +name: Green Light Review Scan |
| 2 | + |
| 3 | +# Manually runs the greenlight scanner (`just review`): lists open pytorch/pytorch PRs |
| 4 | +# from trusted authors and dispatches greenlight-pr-review.yml for each new or changed |
| 5 | +# PR. Read-only on ClickHouse; dispatches the reviewer workflow via the App token. |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + pr: |
| 11 | + description: "Single pytorch/pytorch PR number to scan (empty = all trusted authors)" |
| 12 | + required: false |
| 13 | + default: "" |
| 14 | + type: string |
| 15 | + max: |
| 16 | + description: "Max dispatches this run (empty = no cap)" |
| 17 | + required: false |
| 18 | + default: "" |
| 19 | + type: string |
| 20 | + ref: |
| 21 | + description: "Ref of greenlight-pr-review.yml to dispatch" |
| 22 | + required: false |
| 23 | + default: "main" |
| 24 | + type: string |
| 25 | + timeout_minutes: |
| 26 | + description: "In-flight / re-dispatch timeout (minutes)" |
| 27 | + required: false |
| 28 | + default: "30" |
| 29 | + type: string |
| 30 | + log_level: |
| 31 | + description: "Log verbosity" |
| 32 | + required: false |
| 33 | + default: "INFO" |
| 34 | + type: choice |
| 35 | + options: |
| 36 | + - DEBUG |
| 37 | + - INFO |
| 38 | + - WARNING |
| 39 | + - ERROR |
| 40 | + |
| 41 | +# Singleton: only one scan runs at a time, and a new dispatch waits rather than |
| 42 | +# cancelling an in-flight scan (which could leave dispatch bookkeeping half-done). |
| 43 | +concurrency: |
| 44 | + group: ${{ github.workflow }}-singleton |
| 45 | + cancel-in-progress: false |
| 46 | + |
| 47 | +permissions: |
| 48 | + contents: read |
| 49 | + |
| 50 | +defaults: |
| 51 | + run: |
| 52 | + working-directory: greenlight |
| 53 | + |
| 54 | +jobs: |
| 55 | + scan: |
| 56 | + runs-on: ubuntu-latest |
| 57 | + # Protected environment holding the Green Light App key: GREENLIGHT_APP_ID and |
| 58 | + # GREENLIGHT_APP_PRIVATE_KEY. The App must be installed on pytorch/test-infra with |
| 59 | + # Actions: write and Pull requests: read so the minted token can dispatch the |
| 60 | + # reviewer workflow and read PRs across pytorch/pytorch and pytorch/test-infra. |
| 61 | + environment: greenlight-record |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 64 | + - uses: jdx/mise-action@dad1bfd3df957f44999b559dd69dc1671cb4e9ea # v4.2.1 |
| 65 | + with: |
| 66 | + working_directory: greenlight |
| 67 | + |
| 68 | + - name: Mint Green Light app token |
| 69 | + id: app-token |
| 70 | + uses: actions/create-github-app-token@v2 |
| 71 | + with: |
| 72 | + app-id: ${{ secrets.GREENLIGHT_APP_ID }} |
| 73 | + private-key: ${{ secrets.GREENLIGHT_APP_PRIVATE_KEY }} |
| 74 | + owner: pytorch |
| 75 | + repositories: pytorch,test-infra |
| 76 | + permission-pull-requests: read |
| 77 | + permission-actions: write |
| 78 | + |
| 79 | + - name: Sync dependencies |
| 80 | + run: just setup |
| 81 | + |
| 82 | + - name: Scan and dispatch |
| 83 | + env: |
| 84 | + PYTORCH_GREENLIGHT_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} |
| 85 | + CLICKHOUSE_ENDPOINT: ${{ secrets.CLICKHOUSE_HUD_USER_URL }} |
| 86 | + CLICKHOUSE_USERNAME: ${{ secrets.CLICKHOUSE_HUD_USER_USERNAME }} |
| 87 | + CLICKHOUSE_PASSWORD: ${{ secrets.CLICKHOUSE_HUD_USER_PASSWORD }} |
| 88 | + IN_PR: ${{ inputs.pr }} |
| 89 | + IN_MAX: ${{ inputs.max }} |
| 90 | + IN_REF: ${{ inputs.ref }} |
| 91 | + IN_TIMEOUT: ${{ inputs.timeout_minutes }} |
| 92 | + IN_LOG_LEVEL: ${{ inputs.log_level }} |
| 93 | + run: | |
| 94 | + set -euo pipefail |
| 95 | + args=() |
| 96 | + if [ -n "$IN_PR" ]; then args+=(--pr "$IN_PR"); fi |
| 97 | + if [ -n "$IN_MAX" ]; then args+=(--max "$IN_MAX"); fi |
| 98 | + args+=(--ref "$IN_REF" --timeout-minutes "$IN_TIMEOUT" --log-level "$IN_LOG_LEVEL") |
| 99 | + just review "${args[@]}" |
0 commit comments