From 293fc9a75389318a973291947c92481c88507b04 Mon Sep 17 00:00:00 2001
From: Lexus Drumgold <unicornware@flexdevelopment.llc>
Date: Sat, 7 Jan 2023 23:26:09 -0500
Subject: [PATCH] ci(workflows): add `typescript-canary`

Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
---
 .github/workflows/typescript-canary.yml | 65 +++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 .github/workflows/typescript-canary.yml

diff --git a/.github/workflows/typescript-canary.yml b/.github/workflows/typescript-canary.yml
new file mode 100644
index 00000000..73baba85
--- /dev/null
+++ b/.github/workflows/typescript-canary.yml
@@ -0,0 +1,65 @@
+# TypeScript Canary Check
+#
+# Run type tests against the latest and next versions of TypeScript.
+#
+# References:
+#
+# - https://docs.github.com/actions/learn-github-actions/contexts
+# - https://docs.github.com/actions/using-jobs/using-a-matrix-for-your-jobs
+# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#schedule
+# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
+# - https://github.com/actions/checkout
+# - https://github.com/actions/setup-node
+# - https://vitest.dev/guide/testing-types.html#run-typechecking
+
+---
+name: typescript-canary
+on:
+  schedule:
+    # every monday, 3 hours after typescript@next release
+    # https://github.com/microsoft/TypeScript/blob/v4.9.4/.github/workflows/nightly.yaml
+    - cron: '0 10 * * 1'
+  workflow_dispatch:
+permissions:
+  packages: read
+env:
+  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+  HUSKY: 0
+  REF: ${{ github.head_ref || github.ref_name }}
+jobs:
+  typescript-canary:
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        typescript-version:
+          - next
+          - latest
+    steps:
+      - id: debug
+        name: Print environment variables and event payload
+        uses: hmarr/debug-action@v2.1.0
+      - id: checkout
+        name: Checkout ${{ env.REF }}
+        uses: actions/checkout@v3.2.0
+        with:
+          ref: ${{ env.REF }}
+      - id: node
+        name: Setup Node.js
+        uses: actions/setup-node@v3.5.1
+        with:
+          cache: yarn
+          cache-dependency-path: yarn.lock
+          node-version-file: .nvmrc
+      - id: yarn
+        name: Install dependencies
+        run: yarn ${{ github.actor == 'dependabot[bot]' && '--no-immutable' || '--immutable' }}
+      - id: typescript
+        name: Install typescript@${{ matrix.typescript-version }}
+        run: yarn add -D typescript@${{ matrix.typescript-version }}
+      - id: typecheck
+        name: Run typecheck
+        run: yarn check:types
+      - id: typecheck-build
+        name: Check types:build
+        run: yarn check:types:build