#
# Run all checks on PRs and pushes
#
name: Checks

# Controls when the action will run.
on:
  pull_request:
    types: [opened, synchronize, reopened]

  push:
    branches: [main, next, beta, alpha]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

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

# Declare default permissions as read only.
permissions:
  contents: read

jobs:
  dependencies:
    name: '▶️ actions'
    uses: ./.github/workflows/dependencies.yml
    permissions:
      contents: read
      pull-requests: write

  pr-lint:
    name: '▶️ actions'
    uses: ./.github/workflows/pr-lint.yml
    permissions:
      contents: read
      pull-requests: write

  npm-lint:
    name: '▶️ actions'
    needs: [pr-lint]
    uses: ./.github/workflows/npm-lint.yml
    permissions:
      contents: read

  npm-test:
    name: '▶️ actions'
    needs: [pr-lint]
    uses: ./.github/workflows/npm-test.yml
    permissions:
      contents: read
