about summary refs log tree commit diff
path: root/.github
diff options
context:
space:
mode:
authorDan Abramov <dan.abramov@gmail.com>2024-12-19 04:50:36 +0000
committerDan Abramov <dan.abramov@gmail.com>2024-12-19 05:14:15 +0000
commit513a188a219271bb527f8a4cf3ad978116a407e3 (patch)
tree5e0ca16214d47e683966488a093ee07b7f0dda6f /.github
parent29dad38ab77bd5537cf7f0198fff35d14d776bff (diff)
downloadvoidsky-513a188a219271bb527f8a4cf3ad978116a407e3.tar.zst
Add a GitHub Action verifying lockfile against base
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/verify-yarn-lock.yml38
1 files changed, 38 insertions, 0 deletions
diff --git a/.github/workflows/verify-yarn-lock.yml b/.github/workflows/verify-yarn-lock.yml
new file mode 100644
index 000000000..f5f521e76
--- /dev/null
+++ b/.github/workflows/verify-yarn-lock.yml
@@ -0,0 +1,38 @@
+name: Verify yarn.lock
+
+on:
+  pull_request:
+concurrency:
+  group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}'
+  cancel-in-progress: true
+
+jobs:
+  verify-yarn-lock:
+    name: Verify yarn.lock changes
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check out Git repository
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+      - 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 "${{ 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::1. If this is intentional, you can ignore this check.'
+              echo '::error::2. If this is not intentional, apply the following diff:'
+              echo '```diff'
+              git --no-pager diff -R
+              echo '```'
+              exit 1
+            }
+          attempt_limit: 3
+          attempt_delay: 2000