Skip to content
Latchkey

CI Docs workflow (posit-dev/great-tables)

The CI Docs workflow from posit-dev/great-tables, explained and optimized by Latchkey.

F

CI health: F - at risk

Point runs-on at Latchkey and get caching, run de-duplication, 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: posit-dev/great-tables.github/workflows/ci-docs.yamlLicense MITView source

What it does

This is the CI Docs workflow from the posit-dev/great-tables 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: CI Docs

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  build-docs:
    name: "Build Docs"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.13"
      - name: Install dependencies
        run: |
          python -m pip install --no-cache-dir "great-docs[svg] @ git+https://github.com/posit-dev/great-docs.git@main"
          python -m pip install polars pandas numpy pyarrow plotnine gt-extras pointblank ibis-framework[duckdb]
          python -m pip install ".[extra]"
      - name: Set up Quarto
        uses: quarto-dev/quarto-actions/setup@v2
      - name: Build docs
        run: |
          great-docs build
      - name: Save docs artifact
        uses: actions/upload-artifact@v4
        with:
          name: docs-html
          path: great-docs/_site

  publish-docs:
    name: "Publish Docs"
    runs-on: ubuntu-latest
    needs: "build-docs"
    if: github.ref == 'refs/heads/main'
    steps:
      - uses: actions/download-artifact@v4
        with:
          name: docs-html
          path: great-docs/_site
      - uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: great-docs/_site

  preview-docs:
    name: "Preview Docs"
    runs-on: ubuntu-latest
    needs: "build-docs"
    if: github.event_name == 'pull_request'
    steps:
      - uses: actions/download-artifact@v4
        with:
          name: docs-html
          path: great-docs/_site

      - name: Configure pull release name
        if: ${{github.event_name == 'pull_request'}}
        run: |
          echo "RELEASE_NAME=pr-${PR_NUMBER}" >> $GITHUB_ENV
        env:
          PR_NUMBER: ${{ github.event.number }}
      - name: Configure branch release name
        if: ${{github.event_name != 'pull_request'}}
        run: |
          echo "RELEASE_NAME=${GITHUB_REF_NAME/\//-}" >> $GITHUB_ENV

      - name: Create Github Deployment
        uses: bobheadxi/deployments@v1
        id: deployment
        if: ${{ !github.event.pull_request.head.repo.fork }}
        with:
          step: start
          token: ${{ secrets.GITHUB_TOKEN }}
          env: ${{ env.RELEASE_NAME }}
          ref: ${{ github.head_ref }}
          transient: true
          logs: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"

      - name: Netlify docs preview
        if: ${{ !github.event.pull_request.head.repo.fork }}
        run: |
          npm install -g netlify-cli
          netlify link --name="gt-python"
          if [ "${ALIAS}" == "main" ]; then
            netlify deploy --dir=great-docs/_site --alias="main"
          else
            netlify deploy --dir=great-docs/_site --alias="${ALIAS}"
          fi
        env:
          NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
          ALIAS: ${{ steps.deployment.outputs.env }}

      - name: Update Github Deployment
        uses: bobheadxi/deployments@v1
        if: ${{ !github.event.pull_request.head.repo.fork && always() }}
        with:
          step: finish
          token: ${{ secrets.GITHUB_TOKEN }}
          status: ${{ job.status }}
          env: ${{ steps.deployment.outputs.env }}
          env_url: "https://${{ steps.deployment.outputs.env }}--gt-python.netlify.app"
          deployment_id: ${{ steps.deployment.outputs.deployment_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.

name: CI Docs
 
on:
  push:
    branches:
      - main
  pull_request:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build-docs:
    timeout-minutes: 30
    name: "Build Docs"
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: "3.13"
      - name: Install dependencies
        run: |
          python -m pip install --no-cache-dir "great-docs[svg] @ git+https://github.com/posit-dev/great-docs.git@main"
          python -m pip install polars pandas numpy pyarrow plotnine gt-extras pointblank ibis-framework[duckdb]
          python -m pip install ".[extra]"
      - name: Set up Quarto
        uses: quarto-dev/quarto-actions/setup@v2
      - name: Build docs
        run: |
          great-docs build
      - name: Save docs artifact
        uses: actions/upload-artifact@v4
        with:
          name: docs-html
          path: great-docs/_site
 
  publish-docs:
    timeout-minutes: 30
    name: "Publish Docs"
    runs-on: latchkey-small
    needs: "build-docs"
    if: github.ref == 'refs/heads/main'
    steps:
      - uses: actions/download-artifact@v4
        with:
          name: docs-html
          path: great-docs/_site
      - uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: great-docs/_site
 
  preview-docs:
    timeout-minutes: 30
    name: "Preview Docs"
    runs-on: latchkey-small
    needs: "build-docs"
    if: github.event_name == 'pull_request'
    steps:
      - uses: actions/download-artifact@v4
        with:
          name: docs-html
          path: great-docs/_site
 
      - name: Configure pull release name
        if: ${{github.event_name == 'pull_request'}}
        run: |
          echo "RELEASE_NAME=pr-${PR_NUMBER}" >> $GITHUB_ENV
        env:
          PR_NUMBER: ${{ github.event.number }}
      - name: Configure branch release name
        if: ${{github.event_name != 'pull_request'}}
        run: |
          echo "RELEASE_NAME=${GITHUB_REF_NAME/\//-}" >> $GITHUB_ENV
 
      - name: Create Github Deployment
        uses: bobheadxi/deployments@v1
        id: deployment
        if: ${{ !github.event.pull_request.head.repo.fork }}
        with:
          step: start
          token: ${{ secrets.GITHUB_TOKEN }}
          env: ${{ env.RELEASE_NAME }}
          ref: ${{ github.head_ref }}
          transient: true
          logs: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
 
      - name: Netlify docs preview
        if: ${{ !github.event.pull_request.head.repo.fork }}
        run: |
          npm install -g netlify-cli
          netlify link --name="gt-python"
          if [ "${ALIAS}" == "main" ]; then
            netlify deploy --dir=great-docs/_site --alias="main"
          else
            netlify deploy --dir=great-docs/_site --alias="${ALIAS}"
          fi
        env:
          NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
          ALIAS: ${{ steps.deployment.outputs.env }}
 
      - name: Update Github Deployment
        uses: bobheadxi/deployments@v1
        if: ${{ !github.event.pull_request.head.repo.fork && always() }}
        with:
          step: finish
          token: ${{ secrets.GITHUB_TOKEN }}
          status: ${{ job.status }}
          env: ${{ steps.deployment.outputs.env }}
          env_url: "https://${{ steps.deployment.outputs.env }}--gt-python.netlify.app"
          deployment_id: ${{ steps.deployment.outputs.deployment_id }}
 

What changed

3 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.

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 3 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