name: danger

on: [pull_request, workflow_dispatch]

concurrency:
    group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
    cancel-in-progress: true

jobs:
  danger:
    runs-on: macos-14
    steps:
    - uses: actions/checkout@v4
    - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
    - name: Setup Bundler
      run: scripts/setup_bundler.sh
    - name: Danger
      env:
        DANGER_GITHUB_API_TOKEN: ${{ secrets.DangerGitHubAPIToken }}
      run:  '[ ! -z $DANGER_GITHUB_API_TOKEN ] && bundle exec danger || echo "Skipping Danger for External Contributor"'
