Skip to content
Latchkey

Cut Nightly Branch workflow (ampproject/amphtml)

The Cut Nightly Branch workflow from ampproject/amphtml, explained and optimized by Latchkey.

C

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.

Grade your own workflow free or run it on Latchkey →
Source: ampproject/amphtml.github/workflows/cut-nightly.ymlLicense Apache-2.0View source

What it does

This is the Cut Nightly Branch workflow from the ampproject/amphtml repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
# Cuts a new nightly branch on a schedule.

name: Cut Nightly Branch

on:
  schedule:
    # 1 a.m. PST / 12 a.m. PDT, Tuesdays through Saturdays.
    - cron: '0 8 * * 2-6'
  workflow_dispatch:

permissions:
  contents: read

jobs:
  cut-nightly:
    environment: cut_nightly
    if: github.repository == 'ampproject/amphtml'
    name: Cut Nightly Branch
    runs-on: ubuntu-latest

    steps:
      - name: Harden Runner
        uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
        with:
          egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs

      - name: Checkout Repo
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
        with:
          fetch-depth: 100

      - name: Set Up Node
        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
        with:
          node-version: lts/*

      - name: Set Up Environment
        run: sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

      - name: Install Dependencies
        run: npm ci

      - name: ⭐ Cut Nightly Branch ⭐
        run: node --unhandled-rejections=strict build-system/release-workflows/cut-nightly.js
        env:
          GITHUB_TOKEN: ${{ secrets.AMPPROJECTBOT }}

  create-issue-on-error:
    if: failure()
    needs: cut-nightly
    permissions:
      contents: read
      issues: write
    runs-on: ubuntu-latest
    environment: create_issue_on_error
    steps:
      - name: Harden Runner
        uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
        with:
          egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs

      - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

      - name: Create issue on error
        uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2
        with:
          filename: .github/create_issue_on_error.md
        env:
          GITHUB_TOKEN: ${{ secrets.AMPPROJECTBOT }}
          WORKFLOW_NAME: ${{ github.workflow }}
          MENTION: '@ampproject/release-on-duty'
          REPO_SLUG: ${{ github.repository }}
          RUN_ID: ${{ github.run_id }}

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.

# Cuts a new nightly branch on a schedule.
 
name: Cut Nightly Branch
 
on:
  schedule:
    # 1 a.m. PST / 12 a.m. PDT, Tuesdays through Saturdays.
    - cron: '0 8 * * 2-6'
  workflow_dispatch:
 
permissions:
  contents: read
 
jobs:
  cut-nightly:
    timeout-minutes: 30
    environment: cut_nightly
    if: github.repository == 'ampproject/amphtml'
    name: Cut Nightly Branch
    runs-on: latchkey-small
 
    steps:
      - name: Harden Runner
        uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
        with:
          egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
 
      - name: Checkout Repo
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
        with:
          fetch-depth: 100
 
      - name: Set Up Node
        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
        with:
          cache: 'npm'
          node-version: lts/*
 
      - name: Set Up Environment
        run: sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
 
      - name: Install Dependencies
        run: npm ci
 
      - name: ⭐ Cut Nightly Branch ⭐
        run: node --unhandled-rejections=strict build-system/release-workflows/cut-nightly.js
        env:
          GITHUB_TOKEN: ${{ secrets.AMPPROJECTBOT }}
 
  create-issue-on-error:
    timeout-minutes: 30
    if: failure()
    needs: cut-nightly
    permissions:
      contents: read
      issues: write
    runs-on: latchkey-small
    environment: create_issue_on_error
    steps:
      - name: Harden Runner
        uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
        with:
          egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
 
      - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
 
      - name: Create issue on error
        uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2
        with:
          filename: .github/create_issue_on_error.md
        env:
          GITHUB_TOKEN: ${{ secrets.AMPPROJECTBOT }}
          WORKFLOW_NAME: ${{ github.workflow }}
          MENTION: '@ampproject/release-on-duty'
          REPO_SLUG: ${{ github.repository }}
          RUN_ID: ${{ github.run_id }}
 

What changed

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:

This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow