summaryrefslogtreecommitdiff
path: root/.github/workflows/auto_review_pr.yml
blob: bb84a51573814b11cb81d6d5a63a15ea8b2cffbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Auto Review PR
on:
  pull_request_target:
    types: [opened, ready_for_review, reopened]
    branches: [master]
  workflow_dispatch:
    inputs:
      pr_number:
        description: 'PR number to review'
        required: true
        type: number

permissions:
  contents: read

jobs:
  auto-review-pr:
    name: Auto Review PR
    runs-on: ubuntu-latest
    if: ${{ github.repository == 'ruby/ruby' && (github.base_ref == 'master' || github.event_name == 'workflow_dispatch') }}

    permissions:
      pull-requests: write
      contents: read

    steps:
      - name: Checkout repository
        uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
        with:
          persist-credentials: false

      - uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
        with:
          ruby-version: '3.4'
          bundler: none

      - name: Auto Review PR
        run: ruby tool/auto_review_pr.rb "$GITHUB_PR_NUMBER"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_PR_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr_number }}