name: What's up Danger?

on:
  pull_request:
    branches:
      - 'main'
      - '*-stable'

jobs:
  danger:
    runs-on: ubuntu-latest
    env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
      BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
    if: false
    # if: github.event_name  == 'pull_request' # if only run pull request when multiple trigger workflow
    strategy:
      fail-fast: false
      matrix:
        gemfile:
          - vanilla
        rubygems:
          - latest
        bundler:
          - latest
        ruby:
          - "ruby"
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Setup Ruby & Bundle
        uses: ruby/setup-ruby@v1.288.0
        with:
          ruby-version: ${{ matrix.ruby }}
          rubygems: ${{ matrix.rubygems }}
          bundler: ${{ matrix.bundler }}
          bundler-cache: true
      - uses: MeilCli/danger-action@v6
        with:
          plugins_file: 'Gemfile'
          install_path: 'vendor/bundle'
          danger_file: 'Dangerfile'
          danger_id: 'danger-pr'
        env:
          DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
