π AutoPub PR Check workflow (strawberry-graphql/strawberry-django)
The π AutoPub PR Check workflow from strawberry-graphql/strawberry-django, explained and optimized by Latchkey.
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.
What it does
This is the π AutoPub PR Check workflow from the strawberry-graphql/strawberry-django 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
name: π AutoPub PR Check
on:
pull_request_target:
branches: [main]
permissions:
contents: read
jobs:
check-release:
name: π¦ Check for release
if: github.event.pull_request.user.type != 'Bot'
runs-on: ubuntu-latest
outputs:
has_release: ${{ steps.check.outputs.has_release }}
steps:
- uses: actions/checkout@v4
with:
ref: "refs/pull/${{ github.event.number }}/merge"
sparse-checkout: |
RELEASE.md
pyproject.toml
sparse-checkout-cone-mode: false
- name: Check for release
id: check
uses: autopub/autopub-action@5fdc82e84c048a82303de6b5c5a9d027665e73cf # v1.1.1
with:
command: check
autopub-version: "1.0.0a58"
github-token: ${{ secrets.BOT_TOKEN }}
fail-on-missing: "true"
extra-plugins: strawberry-autopub-plugins
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: π AutoPub PR Check on: pull_request_target: branches: [main] permissions: contents: read jobs: check-release: timeout-minutes: 30 name: π¦ Check for release if: github.event.pull_request.user.type != 'Bot' runs-on: latchkey-small outputs: has_release: ${{ steps.check.outputs.has_release }} steps: - uses: actions/checkout@v4 with: ref: "refs/pull/${{ github.event.number }}/merge" sparse-checkout: | RELEASE.md pyproject.toml sparse-checkout-cone-mode: false - name: Check for release id: check uses: autopub/autopub-action@5fdc82e84c048a82303de6b5c5a9d027665e73cf # v1.1.1 with: command: check autopub-version: "1.0.0a58" github-token: ${{ secrets.BOT_TOKEN }} fail-on-missing: "true" extra-plugins: strawberry-autopub-plugins
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. - 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.