Nightly workflow (dillonzq/LoveIt)
The Nightly workflow from dillonzq/LoveIt, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Nightly workflow from the dillonzq/LoveIt 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: Nightly
on:
schedule:
- cron: "0 10 * * *"
workflow_dispatch:
inputs:
hugo_version:
description: "Hugo version (e.g. 0.146.0 or latest)"
required: true
default: "latest"
permissions:
contents: read
concurrency:
group: nightly
cancel-in-progress: true
jobs:
build-and-validate:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
hugo_env: [ production, development ]
include:
- hugo_env: production
build_args: "--source exampleSite --gc --minify --panicOnWarning"
- hugo_env: development
build_args: "--source exampleSite --buildDrafts --buildFuture"
env:
HUGO_ENV: ${{ matrix.hugo_env }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.hugo_version || 'latest' }}
extended: true
- name: Build
run: |
hugo ${{ matrix.build_args }}
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
- name: Install Validator
run: gem install html-proofer -v 5.2.0
- name: Validate Output
run: |
htmlproofer ./exampleSite/public \
--disable-external \
--ignore-missing-alt \
--no-enforce-https
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Nightly on: schedule: - cron: "0 10 * * *" workflow_dispatch: inputs: hugo_version: description: "Hugo version (e.g. 0.146.0 or latest)" required: true default: "latest" permissions: contents: read concurrency: group: nightly cancel-in-progress: true jobs: build-and-validate: timeout-minutes: 30 runs-on: latchkey-small strategy: fail-fast: false matrix: hugo_env: [ production, development ] include: - hugo_env: production build_args: "--source exampleSite --gc --minify --panicOnWarning" - hugo_env: development build_args: "--source exampleSite --buildDrafts --buildFuture" env: HUGO_ENV: ${{ matrix.hugo_env }} steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 submodules: recursive - name: Setup Hugo uses: peaceiris/actions-hugo@v3 with: hugo-version: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.hugo_version || 'latest' }} extended: true - name: Build run: | hugo ${{ matrix.build_args }} - name: Setup Ruby uses: ruby/setup-ruby@v1 with: ruby-version: "3.3" - name: Install Validator run: gem install html-proofer -v 5.2.0 - name: Validate Output run: | htmlproofer ./exampleSite/public \ --disable-external \ --ignore-missing-alt \ --no-enforce-https
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.
2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
This workflow runs 1 job (2 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.