name: build

on:
  push:
  pull_request_target:
    types: [labeled]

jobs:
  build:
    runs-on: ubuntu-latest
    if: |
      github.event_name == 'push' ||
      contains(github.event.pull_request.labels.*.name, 'run_ci')
    strategy:
      matrix:
        ruby:
        # https://hub.docker.com/_/ruby
        - '2.5'
        - '2.6'
        - '2.7'
        - '3.0'
        - '3.1'
        - 'latest'
    container:
      image: ruby:${{ matrix.ruby }}

    steps:
    - uses: actions/checkout@v2
    - name: Build and test with Rake
      run: |
        gem install bundler
        bundle install --jobs 4 --retry 3
        bundle exec rake

name: build

on:
  push:
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby:
        # https://hub.docker.com/_/ruby
        - '2.5'
        - '2.6'
        - '2.7'
        - '3.0'
        - '3.1'
        - 'latest'
    container:
      image: ruby:${{ matrix.ruby }}

    steps:
    - uses: actions/checkout@v2
    - name: Build and test with Rake
      run: |
        gem install bundler
        bundle install --jobs 4 --retry 3
        bundle exec rake

Use pull_request instead of pull_request_target
[CI] Use pull_request instead of pull_request_target
