Skip to content
Latchkey

Beta workflow (playcanvas/engine)

The Beta workflow from playcanvas/engine, explained and optimized by Latchkey.

A

CI health: A - excellent

Point runs-on at Latchkey and get 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: playcanvas/engine.github/workflows/beta.ymlLicense MITView source

What it does

This is the Beta workflow from the playcanvas/engine 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: Beta

on:
  schedule:
    - cron: "0 2 * * *"
  workflow_dispatch:
    inputs:
      force:
        description: "Force release even if no changes detected"
        type: boolean
        default: false

permissions:
  contents: write

jobs:
  beta:
    runs-on: ubuntu-latest
    if: github.repository == 'playcanvas/engine' && github.ref_name == 'main'
    steps:
      - name: Generate app token
        id: app-token
        uses: actions/create-github-app-token@v3
        with:
          app-id: ${{ secrets.APP_ID }}
          private-key: ${{ secrets.APP_KEY }}

      - name: Check out code
        uses: actions/checkout@v7.0.0
        with:
          fetch-depth: 0
          token: ${{ steps.app-token.outputs.token }}

      - name: Set up Node.js 24.x
        uses: actions/setup-node@v6
        with:
          node-version: 24.x
          cache: "npm"

      - name: Configure Git User
        run: |
          git config --global user.email "playcanvas[bot]@users.noreply.github.com"
          git config --global user.name "PlayCanvas [bot]"
        shell: bash

      - name: Check for changes
        id: changes
        run: |
          if [[ "${{ github.event.inputs.force }}" == "true" ]]; then
            echo "has_changes=true" >> "$GITHUB_OUTPUT"
            exit 0
          fi

          last_tag=$(git describe --tags --match "v*-beta.*" --abbrev=0 2>/dev/null || true)
          if [[ -z "$last_tag" ]]; then
            echo "No beta tag found"
            echo "has_changes=true" >> "$GITHUB_OUTPUT"
          elif ! git diff --quiet --exit-code "$last_tag"..HEAD; then
            echo "Changes found since $last_tag"
            echo "has_changes=true" >> "$GITHUB_OUTPUT"
          else
            echo "No changes detected since $last_tag"
            echo "has_changes=false" >> "$GITHUB_OUTPUT"
          fi

      - name: Bump version
        if: steps.changes.outputs.has_changes == 'true'
        run: |
          npm version prerelease --preid=beta

      - name: Push version
        if: steps.changes.outputs.has_changes == 'true'
        run: |
          git push origin HEAD:${{ github.ref_name }}
          git push origin --tags
        shell: bash

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Beta
 
on:
  schedule:
    - cron: "0 2 * * *"
  workflow_dispatch:
    inputs:
      force:
        description: "Force release even if no changes detected"
        type: boolean
        default: false
 
permissions:
  contents: write
 
jobs:
  beta:
    timeout-minutes: 30
    runs-on: latchkey-small
    if: github.repository == 'playcanvas/engine' && github.ref_name == 'main'
    steps:
      - name: Generate app token
        id: app-token
        uses: actions/create-github-app-token@v3
        with:
          app-id: ${{ secrets.APP_ID }}
          private-key: ${{ secrets.APP_KEY }}
 
      - name: Check out code
        uses: actions/checkout@v7.0.0
        with:
          fetch-depth: 0
          token: ${{ steps.app-token.outputs.token }}
 
      - name: Set up Node.js 24.x
        uses: actions/setup-node@v6
        with:
          node-version: 24.x
          cache: "npm"
 
      - name: Configure Git User
        run: |
          git config --global user.email "playcanvas[bot]@users.noreply.github.com"
          git config --global user.name "PlayCanvas [bot]"
        shell: bash
 
      - name: Check for changes
        id: changes
        run: |
          if [[ "${{ github.event.inputs.force }}" == "true" ]]; then
            echo "has_changes=true" >> "$GITHUB_OUTPUT"
            exit 0
          fi
 
          last_tag=$(git describe --tags --match "v*-beta.*" --abbrev=0 2>/dev/null || true)
          if [[ -z "$last_tag" ]]; then
            echo "No beta tag found"
            echo "has_changes=true" >> "$GITHUB_OUTPUT"
          elif ! git diff --quiet --exit-code "$last_tag"..HEAD; then
            echo "Changes found since $last_tag"
            echo "has_changes=true" >> "$GITHUB_OUTPUT"
          else
            echo "No changes detected since $last_tag"
            echo "has_changes=false" >> "$GITHUB_OUTPUT"
          fi
 
      - name: Bump version
        if: steps.changes.outputs.has_changes == 'true'
        run: |
          npm version prerelease --preid=beta
 
      - name: Push version
        if: steps.changes.outputs.has_changes == 'true'
        run: |
          git push origin HEAD:${{ github.ref_name }}
          git push origin --tags
        shell: bash
 

What changed

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

Actions used in this workflow