Skip to content

strict typecheck

strict typecheck #1

name: TypeScript (Strict)
on:
workflow_dispatch:
push:
branches:
- "*.*.*"
- "main"
- "master"
- "strict-typecheck"
pull_request:
branches: "*"
permissions:
contents: read
jobs:
typecheck:
name: Typecheck (Strict)
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-modules-
- name: Install Dependencies
run: npm install
- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v34
with:
files: |
**/*.ts
**/*.tsx
- name: Run Typecheck on Changed Files
if: steps.changed-files.outputs.any_changed == 'true'
run: |
CHANGED_FILES=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep -E '\.tsx?$')
if [ -n "$CHANGED_FILES" ]; then
npm run typecheck -- --strict $CHANGED_FILES
else
echo "No TypeScript files changed."
fi