Skip to content
Latchkey

Bad files check workflow (tabulator-tables/tabulator)

The Bad files check workflow from tabulator-tables/tabulator, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: tabulator-tables/tabulator.github/workflows/bad-files-check.ymlLicense MITView source

What it does

This is the Bad files check workflow from the tabulator-tables/tabulator repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Bad files check
on:
  pull_request:

jobs:
  check:
    name: Dist check
    runs-on: ubuntu-latest
    steps:
      - name: Check out Git repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0


      - name: Get specific changed files in dist
        id: changed-files-specific
        uses: tj-actions/changed-files@v41
        with:
          files: |
            dist

      - name: Check file existence
        id: check_files
        uses: andstor/file-existence-action@v1
        with:
          files: "yarn.lock"

      - name: Fail if dist files changed
        if: steps.changed-files-specific.outputs.any_changed == 'true'
        run: |
          echo "Oops! Looks like you modified some files in dist/. Please remove them from your PR, thanks!"
          exit 1

      - name: Fail if yarn lock exists
        if: steps.check_files.outputs.files_exists == 'true'
        run: |
          echo "Oops! Looks like you checked in a yarn.lock file, we use npm and package-lock.json. Please remove it from your PR, thanks!"
          exit 1

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Bad files check
on:
  pull_request:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  check:
    timeout-minutes: 30
    name: Dist check
    runs-on: latchkey-small
    steps:
      - name: Check out Git repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
 
 
      - name: Get specific changed files in dist
        id: changed-files-specific
        uses: tj-actions/changed-files@v41
        with:
          files: |
            dist
 
      - name: Check file existence
        id: check_files
        uses: andstor/file-existence-action@v1
        with:
          files: "yarn.lock"
 
      - name: Fail if dist files changed
        if: steps.changed-files-specific.outputs.any_changed == 'true'
        run: |
          echo "Oops! Looks like you modified some files in dist/. Please remove them from your PR, thanks!"
          exit 1
 
      - name: Fail if yarn lock exists
        if: steps.check_files.outputs.files_exists == 'true'
        run: |
          echo "Oops! Looks like you checked in a yarn.lock file, we use npm and package-lock.json. Please remove it from your PR, thanks!"
          exit 1
 

What changed

2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow