Enforce all checks workflow (corazawaf/coraza)
The Enforce all checks workflow from corazawaf/coraza, explained and optimized by Latchkey.
C
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Enforce all checks workflow from the corazawaf/coraza 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)
# Aggregates the results of all other checks into a single required status check.
# It must run on every pull request, with no path filters: a required check that
# lives in a path-filtered workflow never reports on PRs that skip it (e.g.
# docs-only changes), leaving them blocked forever.
name: Enforce all checks
on:
pull_request:
branches:
- main
permissions: {}
jobs:
enforce-all-checks:
runs-on: ubuntu-latest
permissions:
checks: read
contents: read
steps:
- name: GitHub Checks
uses: poseidon/wait-for-status-checks@899c768d191b56eef585c18f8558da19e1f3e707 # v0.6.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
delay: 30s
interval: 10s # default value
timeout: 3600s # default value
ignore: "codecov/patch,codecov/project"
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
# Aggregates the results of all other checks into a single required status check. # It must run on every pull request, with no path filters: a required check that # lives in a path-filtered workflow never reports on PRs that skip it (e.g. # docs-only changes), leaving them blocked forever. name: Enforce all checks on: pull_request: branches: - main permissions: {} concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: enforce-all-checks: timeout-minutes: 30 runs-on: latchkey-small permissions: checks: read contents: read steps: - name: GitHub Checks uses: poseidon/wait-for-status-checks@899c768d191b56eef585c18f8558da19e1f3e707 # v0.6.0 with: token: ${{ secrets.GITHUB_TOKEN }} delay: 30s interval: 10s # default value timeout: 3600s # default value ignore: "codecov/patch,codecov/project"
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.