Skip to content
Latchkey

Nightly workflow (dillonzq/LoveIt)

The Nightly workflow from dillonzq/LoveIt, explained and optimized by Latchkey.

B

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.

Grade your own workflow free or run it on Latchkey →
Source: dillonzq/LoveIt.github/workflows/nightly.ymlLicense MITView source

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

workflow (.yml)
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

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.

Actions used in this workflow