Sync README Template List workflow (huangwb8/ChineseResearchLaTeX)
The Sync README Template List workflow from huangwb8/ChineseResearchLaTeX, 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 Sync README Template List workflow from the huangwb8/ChineseResearchLaTeX 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: Sync README Template List
on:
schedule:
- cron: "13 * * * *"
release:
types:
- published
- edited
workflow_dispatch:
inputs:
repo:
description: "GitHub repository in owner/name format"
required: false
default: "huangwb8/ChineseResearchLaTeX"
skip_tests:
description: "Skip README template list regression tests"
required: false
default: "false"
permissions:
contents: write
concurrency:
group: sync-readme-template-list
cancel-in-progress: true
jobs:
sync-template-list:
runs-on: ubuntu-latest
env:
TZ: Asia/Shanghai
TARGET_REPO: ${{ inputs.repo || github.repository }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Run README sync regression tests
if: ${{ inputs.skip_tests != 'true' }}
run: |
python -m pip install --upgrade pip
python -m pip install pytest pyyaml
pytest -q scripts/test_update_readme_template_list.py scripts/test_issue_templates.py
- name: Update README template list
env:
GH_TOKEN: ${{ github.token }}
run: python scripts/update_readme_template_list.py --repo "${{ env.TARGET_REPO }}"
- name: Detect changes
id: changes
run: |
if git diff --quiet -- README.md; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Commit README update
if: steps.changes.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "docs: sync template list from latest release"
git push
- name: Verify README contains cv release links
env:
GH_TOKEN: ${{ github.token }}
run: |
python scripts/update_readme_template_list.py --repo "${{ env.TARGET_REPO }}"
if ! grep -q "cv-01" README.md; then
echo "README does not contain cv-01 section"
exit 1
fi
if ! grep -q "cv-01-Overleaf" README.md; then
echo "README does not contain cv-01 Overleaf download link"
exit 1
fi
if ! grep -q "paper-template-customization.yml" README.md; then
echo "README does not contain paper customization issue link"
exit 1
fi
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: Sync README Template List on: schedule: - cron: "13 * * * *" release: types: - published - edited workflow_dispatch: inputs: repo: description: "GitHub repository in owner/name format" required: false default: "huangwb8/ChineseResearchLaTeX" skip_tests: description: "Skip README template list regression tests" required: false default: "false" permissions: contents: write concurrency: group: sync-readme-template-list cancel-in-progress: true jobs: sync-template-list: timeout-minutes: 30 runs-on: latchkey-small env: TZ: Asia/Shanghai TARGET_REPO: ${{ inputs.repo || github.repository }} steps: - name: Checkout uses: actions/checkout@v4 with: ref: ${{ github.event.repository.default_branch }} - name: Setup Python uses: actions/setup-python@v5 with: cache: 'pip' python-version: "3.11" - name: Run README sync regression tests if: ${{ inputs.skip_tests != 'true' }} run: | python -m pip install --upgrade pip python -m pip install pytest pyyaml pytest -q scripts/test_update_readme_template_list.py scripts/test_issue_templates.py - name: Update README template list env: GH_TOKEN: ${{ github.token }} run: python scripts/update_readme_template_list.py --repo "${{ env.TARGET_REPO }}" - name: Detect changes id: changes run: | if git diff --quiet -- README.md; then echo "changed=false" >> "$GITHUB_OUTPUT" else echo "changed=true" >> "$GITHUB_OUTPUT" fi - name: Commit README update if: steps.changes.outputs.changed == 'true' run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git add README.md git commit -m "docs: sync template list from latest release" git push - name: Verify README contains cv release links env: GH_TOKEN: ${{ github.token }} run: | python scripts/update_readme_template_list.py --repo "${{ env.TARGET_REPO }}" if ! grep -q "cv-01" README.md; then echo "README does not contain cv-01 section" exit 1 fi if ! grep -q "cv-01-Overleaf" README.md; then echo "README does not contain cv-01 Overleaf download link" exit 1 fi if ! grep -q "paper-template-customization.yml" README.md; then echo "README does not contain paper customization issue link" exit 1 fi
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.