name: Check dependencies versions

on:
  # Run whenever a pull request is updated
  pull_request:
    branches:
      - main
jobs:
  syncpack:
    if: contains(github.event.pull_request.labels.*.name, 'check dependencies')
    runs-on: ubuntu-latest
    name: Check dependencies
    steps:
      # Check out the branch so we can read/write its files
      - uses: actions/checkout@v3
      # Use Node.js as syncpack is written in that
      - uses: actions/setup-node@v3
        with:
          node-version: 18
      - uses: JamieMason/syncpack-github-action@0.2.2
        continue-on-error: true
        with:
          package-manager: "pnpm"
          bot-username: "Syncpack Bot"
          commit-message: "format and sync package.json files"
          # The workflow will only list mismatched dependencies, and the assignee has to manually fix them.
          # version-mismatches: list mismatches in a comment
          version-mismatches: "lint"
          # semver-range-mismatches: don't align dependency version format
          semver-range-mismatches: "ignore"
          # lockfile-mismatches: don't update lockfiles when mismatches detected
          lockfile-mismatches: "ignore"
          # format-mismatches: don't update package.json when inconsistent formatting detected
          format-mismatches: "ignore"
