Skip to content
Latchkey

Evaluate diff workflow (Lightning-AI/torchmetrics)

The Evaluate diff workflow from Lightning-AI/torchmetrics, explained and optimized by Latchkey.

A

CI health: A - excellent

Point runs-on at Latchkey and get caching, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: Lightning-AI/torchmetrics.github/workflows/_focus-diff.ymlLicense Apache-2.0View source

What it does

This is the Evaluate diff workflow from the Lightning-AI/torchmetrics 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: Evaluate diff

on:
  workflow_call:
    # Map the workflow outputs to job outputs
    outputs:
      test-dirs:
        description: "Test folders"
        value: ${{ jobs.eval-diff.outputs.focus }}

jobs:
  eval-diff:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    # Map the job outputs to step outputs
    outputs:
      focus: ${{ steps.diff-domains.outputs.focus }}
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0

      - name: Get PR diff
        id: diff-domains
        env:
          PR_NUMBER: "${{ github.event.pull_request.number }}"
        run: |
          set -e
          echo $PR_NUMBER
          pip install -q -U packaging fire pyGithub pyopenssl
          echo "focus=$(python .github/assistant.py changed-domains $PR_NUMBER)" >> $GITHUB_OUTPUT

      - run: echo "${{ steps.diff-domains.outputs.focus }}"

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Evaluate diff
 
on:
  workflow_call:
    # Map the workflow outputs to job outputs
    outputs:
      test-dirs:
        description: "Test folders"
        value: ${{ jobs.eval-diff.outputs.focus }}
 
jobs:
  eval-diff:
    runs-on: latchkey-small
    timeout-minutes: 5
    # Map the job outputs to step outputs
    outputs:
      focus: ${{ steps.diff-domains.outputs.focus }}
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
        with:
          cache: 'pip'
 
      - name: Get PR diff
        id: diff-domains
        env:
          PR_NUMBER: "${{ github.event.pull_request.number }}"
        run: |
          set -e
          echo $PR_NUMBER
          pip install -q -U packaging fire pyGithub pyopenssl
          echo "focus=$(python .github/assistant.py changed-domains $PR_NUMBER)" >> $GITHUB_OUTPUT
 
      - run: echo "${{ steps.diff-domains.outputs.focus }}"
 

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

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