Skip to content
Latchkey

loc workflow (Hypfer/Valetudo)

The loc workflow from Hypfer/Valetudo, explained and optimized by Latchkey.

A

CI health: A - excellent

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: Hypfer/Valetudo.github/workflows/loc.ymlLicense Apache-2.0View source

What it does

This is the loc workflow from the Hypfer/Valetudo repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

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

The workflow

workflow (.yml)
{
  "name": "Count Lines of Code",
  "on": [
      "push",
      "pull_request"
  ],
  "jobs": {
    "tokei": {
      "runs-on": "ubuntu-latest",
      "steps": [
        {
          "uses": "actions/checkout@v6"
        },
        {
          "name": "Count Lines of Code (tokei)",
          "uses": "hypfer/tokei-action@master"
        },
        {
          "name": "Upload tokei output as a build artifact",
          "uses": "actions/upload-artifact@v7",
          "with": {
            "name": "loc.txt",
            "path": "loc.txt"
          }
        }
      ]
    }
  }
}

The same workflow, on Latchkey

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

{
  "name": "Count Lines of Code",
  "on": [
      "push",
      "pull_request"
  ],
  "jobs": {
    "tokei": {
      "runs-on": "ubuntu-latest",
      "steps": [
        {
          "uses": "actions/checkout@v6"
        },
        {
          "name": "Count Lines of Code (tokei)",
          "uses": "hypfer/tokei-action@master"
        },
        {
          "name": "Upload tokei output as a build artifact",
          "uses": "actions/upload-artifact@v7",
          "with": {
            "name": "loc.txt",
            "path": "loc.txt"
          }
        }
      ]
    }
  }
}
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 

What changed

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