Skip to content
Latchkey

PouchDB Docs workflow (apache/pouchdb)

The PouchDB Docs workflow from apache/pouchdb, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, 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: apache/pouchdb.github/workflows/docs.ymlLicense Apache-2.0View source

What it does

This is the PouchDB Docs workflow from the apache/pouchdb 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)
name: PouchDB Docs

on:
  push:
    branches: [master]
    paths:
      - '.github/actions/**'
      - '.github/workflows/docs.yml'
      - 'package.json'
      - 'bin/**'
      - 'docs/**'

jobs:

  test-docs:
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout PouchDB repo
        uses: actions/checkout@v4
        with:
          persist-credentials: false
      - uses: ./.github/actions/install-node-package
        with:
          node-version: 24
      - run: BUILD=1 npm run build-site
      - name: Checkout pouchdb-site repo
        uses: actions/checkout@v4
        with:
          repository: apache/pouchdb-site
          ref: asf-site
          path: checked-out-pouchdb-site
          fetch-depth: 0
          token: ${{ secrets.POUCHDB_WEBSITE_BUILD }}
      - name: Commit and push if changed
        env:
          POUCHDB_WEBSITE_BUILD: ${{ secrets.POUCHDB_WEBSITE_BUILD }}
        run: |
          cd checked-out-pouchdb-site

          # git remote add deploy https://asf-ci-deploy:$POUCHDB_WEBSITE_BUILD@github.com/apache/pouchdb-site

          echo "Git remotes:"
          git remote -v

          git config user.email ${{ github.actor }}@users.noreply.github.com
          git config user.name ${{ github.actor }}

          git rm -rf . || true

          cp -R ../docs/_site/. .

          if [[ -n $(git status --porcelain) ]]; then
            echo "Committing changes…"
            git add -A
            git commit -m "Deploy site from ${GITHUB_REPOSITORY}@${GITHUB_SHA}"
            GIT_TRACE=1 GIT_CURL_VERBOSE=1 git push origin asf-site --force
          else
            echo "No changes to commit"
          fi

The same workflow, on Latchkey

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

name: PouchDB Docs
 
on:
  push:
    branches: [master]
    paths:
      - '.github/actions/**'
      - '.github/workflows/docs.yml'
      - 'package.json'
      - 'bin/**'
      - 'docs/**'
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
 
  test-docs:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - name: Checkout PouchDB repo
        uses: actions/checkout@v4
        with:
          persist-credentials: false
      - uses: ./.github/actions/install-node-package
        with:
          node-version: 24
      - run: BUILD=1 npm run build-site
      - name: Checkout pouchdb-site repo
        uses: actions/checkout@v4
        with:
          repository: apache/pouchdb-site
          ref: asf-site
          path: checked-out-pouchdb-site
          fetch-depth: 0
          token: ${{ secrets.POUCHDB_WEBSITE_BUILD }}
      - name: Commit and push if changed
        env:
          POUCHDB_WEBSITE_BUILD: ${{ secrets.POUCHDB_WEBSITE_BUILD }}
        run: |
          cd checked-out-pouchdb-site
 
          # git remote add deploy https://asf-ci-deploy:$POUCHDB_WEBSITE_BUILD@github.com/apache/pouchdb-site
 
          echo "Git remotes:"
          git remote -v
 
          git config user.email ${{ github.actor }}@users.noreply.github.com
          git config user.name ${{ github.actor }}
 
          git rm -rf . || true
 
          cp -R ../docs/_site/. .
 
          if [[ -n $(git status --porcelain) ]]; then
            echo "Committing changes…"
            git add -A
            git commit -m "Deploy site from ${GITHUB_REPOSITORY}@${GITHUB_SHA}"
            GIT_TRACE=1 GIT_CURL_VERBOSE=1 git push origin asf-site --force
          else
            echo "No changes to commit"
          fi

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