# Copyright 2020 Signal Messenger, LLC
# SPDX-License-Identifier: AGPL-3.0-only

name: Danger
on:
  pull_request:

jobs:
  danger:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
        with:
          fetch-depth: 0 # fetch all history
      - name: Setup pnpm
        uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
      - name: Setup node.js
        uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
        with:
          node-version-file: '.nvmrc'
          package-manager-cache: false # Avoid cache key clashes
      - name: Install danger node_modules
        run: cd danger && pnpm install
      - name: Run DangerJS
        run: pnpm run danger:ci
        env:
          DANGER_GITHUB_API_TOKEN: ${{ secrets.AUTOMATED_GITHUB_PAT }}
