Sync Docs Selector workflow (scikit-hep/awkward)
The Sync Docs Selector workflow from scikit-hep/awkward, 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.
What it does
This is the Sync Docs Selector workflow from the scikit-hep/awkward 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: Sync Docs Selector
on:
push:
branches:
- main
paths:
- docs/switcher.json
workflow_dispatch:
permissions:
contents: read
concurrency:
group: 'docs-version-${{ github.head_ref || github.run_id }}'
cancel-in-progress: true
jobs:
coverage:
runs-on: ubuntu-22.04
name: Push version switcher
permissions:
id-token: write # Required to assume the AWS deployment role through OIDC.
contents: read
env:
S3_BUCKET: "awkward-array.org"
CLOUDFRONT_ID: "EFM4QVENUIXHS"
environment:
name: docs
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@254c19bd240aabef8777f48595e9d2d7b972184b # v6.2.1
with:
aws-region: eu-west-2
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOY_ROLE }}
# Pushes to main trigger latest
- name: Push version selector
run: |
aws s3 cp docs/switcher.json "s3://${S3_BUCKET}/doc/switcher.json"
aws cloudfront create-invalidation --distribution-id "${CLOUDFRONT_ID}" \
--paths "/doc/switcher.json"
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Sync Docs Selector on: push: branches: - main paths: - docs/switcher.json workflow_dispatch: permissions: contents: read concurrency: group: 'docs-version-${{ github.head_ref || github.run_id }}' cancel-in-progress: true jobs: coverage: timeout-minutes: 30 runs-on: latchkey-small name: Push version switcher permissions: id-token: write # Required to assume the AWS deployment role through OIDC. contents: read env: S3_BUCKET: "awkward-array.org" CLOUDFRONT_ID: "EFM4QVENUIXHS" environment: name: docs steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@254c19bd240aabef8777f48595e9d2d7b972184b # v6.2.1 with: aws-region: eu-west-2 role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOY_ROLE }} # Pushes to main trigger latest - name: Push version selector run: | aws s3 cp docs/switcher.json "s3://${S3_BUCKET}/doc/switcher.json" aws cloudfront create-invalidation --distribution-id "${CLOUDFRONT_ID}" \ --paths "/doc/switcher.json"
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.