Auto-Generate README workflow (awesome-opencode/awesome-opencode)
The Auto-Generate README workflow from awesome-opencode/awesome-opencode, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get caching, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Auto-Generate README workflow from the awesome-opencode/awesome-opencode repository, a real project running GitHub Actions. It is shown here with attribution under its CC0-1.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Auto-Generate README
on:
push:
branches:
- main
paths:
- 'data/**'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: auto-generate-readme-main
cancel-in-progress: false
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
persist-credentials: true
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Generate and push README/registry
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
for attempt in 1 2 3 4 5; do
echo "Generation attempt ${attempt}"
git fetch origin main
git reset --hard origin/main
node scripts/generate-readme.js
node scripts/export-json.js --pretty --output dist/registry.json
if git diff --quiet -- README.md dist/registry.json; then
echo "README.md and dist/registry.json are already current."
exit 0
fi
git add README.md dist/registry.json
git commit -m "docs: auto-regenerate README and registry data"
if git push origin HEAD:main; then
exit 0
fi
echo "Push raced with another main update; retrying..."
sleep 2
done
echo "Failed to push regenerated README/registry after retries" >&2
exit 1
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: Auto-Generate README on: push: branches: - main paths: - 'data/**' workflow_dispatch: permissions: contents: write concurrency: group: auto-generate-readme-main cancel-in-progress: false jobs: generate: timeout-minutes: 30 runs-on: latchkey-small steps: - name: Checkout uses: actions/checkout@v4 with: ref: ${{ github.ref }} persist-credentials: true - name: Setup Node.js 20 uses: actions/setup-node@v4 with: cache: 'npm' node-version: '20' - name: Install dependencies run: npm ci - name: Generate and push README/registry run: | set -euo pipefail git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" for attempt in 1 2 3 4 5; do echo "Generation attempt ${attempt}" git fetch origin main git reset --hard origin/main node scripts/generate-readme.js node scripts/export-json.js --pretty --output dist/registry.json if git diff --quiet -- README.md dist/registry.json; then echo "README.md and dist/registry.json are already current." exit 0 fi git add README.md dist/registry.json git commit -m "docs: auto-regenerate README and registry data" if git push origin HEAD:main; then exit 0 fi echo "Push raced with another main update; retrying..." sleep 2 done echo "Failed to push regenerated README/registry after retries" >&2 exit 1
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. - Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
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:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.