tsc-diagnostics-diff-action

Compare TypeScript Compiler Performance

MIT License

Stars
65
Committers
3

Bot releases are visible (Hide)

tsc-diagnostics-diff-action - v.0.0.1 Latest Release

Published by beerose over 1 year ago

TypeScript Performance Diagnostics Diff Action

This GitHub action allows you to measure and track TypeScript performance regressions in your projects by comparing tsc --diagnostics (or --extendedDiagnostics based on your configuration) outputs between the base branch and the current branch.

Inputs

  • base-branch: The branch that the actions should use to compare TSC performance (default: 'main').
  • custom-command: Allows to override the default type check command. Your custom command should print either --diagnostics or --extendedDiagnostics output. (default: yarn tsc --noEmit --incremental false --diagnostics/--extendedDiagnostics).
  • leave-comment: Indicates whether the action should leave a comment on a PR. Enabling this requires providing the github-token input (default: false).
  • github-token: GitHub API token. Necessary to leave comments on your PRs.
  • extended: Indicates whether the actions should use --extendedDiagnostics over --diagnostics (default: false).

Usage

You can add this action to your workflow file like this:

name: Check TypeScript Performance

on:
  pull_request:

jobs:
  check-performance:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Use Node.js 16.x
        uses: actions/setup-node@v2
        with:
          node-version: 16.x
      - name: Install dependencies
        run: npm ci
      - name: TSC Diagnostics Diff
        uses: beerose/tsc-diagnostics-diff@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          leave-comment: true

This example uses GITHUB_TOKEN to leave a comment on PRs with the comparison of the diagnostic.

Example output