name: Check format token list

on:
  pull_request:
  push:
    branches:
      - main

defaults:
  run:
    shell: bash

jobs:
  check-token-list:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: "18"

      - name: Install dependencies
        shell: bash
        run: |
          echo "//npm.pkg.github.com/:_authToken=${{ secrets.SDK_READ_ACCESS_TOKEN }}" >> ~/.npmrc 
          yarn install --frozen-lockfile
          rm -f ~/.npmrc
      - name: Validate JSON file
        run: yarn validate