about summary refs log tree commit diff
path: root/.github/workflows/verify-yarn-lock.yml
blob: aa4568f5cfa16bd3b394b4ab28cf985949b55398 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Lockfile

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

jobs:
  verify-yarn-lock:
    name: No manual yarn.lock edits
    runs-on: ubuntu-latest
    steps:
      - name: Check out PR HEAD
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Fetch base branch
        run: git fetch origin ${{ github.base_ref }} --depth=1

      - name: Install node
        uses: actions/setup-node@v4
        with:
          node-version-file: .nvmrc

      - name: Verify yarn.lock
        uses: Wandalen/wretry.action@master
        with:
          command: |
            git show "origin/${{ github.base_ref }}:yarn.lock" > yarn.lock
            yarn
            git diff --quiet --exit-code || {
              echo '::error::`yarn.lock` does not match what Yarn would generate given the base `yarn.lock` and the head `package.json`.'
              echo '::error:: - If this is intentional, you can ignore this check.'
              echo '::error:: - If this is unintentional, apply the following diff:'
              git --no-pager diff
              exit 1
            }
          attempt_limit: 3
          attempt_delay: 2000