Skip to content
Latchkey

Ruff workflow (torchbox/wagtailmedia)

The Ruff workflow from torchbox/wagtailmedia, explained and optimized by Latchkey.

A

CI health: A - excellent

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

Grade your own workflow free or run it on Latchkey →
Source: torchbox/wagtailmedia.github/workflows/ruff.ymlLicense BSD-3-ClauseView source

What it does

This is the Ruff workflow from the torchbox/wagtailmedia repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.

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

The workflow

workflow (.yml)
name: Ruff

on:
  push:
    branches:
      - main
      - 'stable/**'
  pull_request:
    branches: [main]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions: {}

jobs:
  ruff:
    name: Ruff
    runs-on: ubuntu-latest
    permissions:
      contents: read

    steps:
    - name: Harden Runner
      uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411  # v2.19.4

      with:
        disable-sudo: true
        egress-policy: block
        allowed-endpoints: >
          files.pythonhosted.org:443
          objects.githubusercontent.com:443
          github.com:443
          pypi.org:443
          api.github.com:443

    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd  # v6.0.2
      with:
        persist-credentials: false

    - run: python -Im pip install --user ruff==0.15.13

    - name: Run ruff
      working-directory: ./src
      run: ruff check --output-format=github wagtailmedia

The same workflow, on Latchkey

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

name: Ruff
 
on:
  push:
    branches:
      - main
      - 'stable/**'
  pull_request:
    branches: [main]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
permissions: {}
 
jobs:
  ruff:
    timeout-minutes: 30
    name: Ruff
    runs-on: latchkey-small
    permissions:
      contents: read
 
    steps:
    - name: Harden Runner
      uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411  # v2.19.4
 
      with:
        disable-sudo: true
        egress-policy: block
        allowed-endpoints: >
          files.pythonhosted.org:443
          objects.githubusercontent.com:443
          github.com:443
          pypi.org:443
          api.github.com:443
 
    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd  # v6.0.2
      with:
        persist-credentials: false
 
    - run: python -Im pip install --user ruff==0.15.13
 
    - name: Run ruff
      working-directory: ./src
      run: ruff check --output-format=github wagtailmedia
 

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