Skip to content
Latchkey

Docs JSON Export workflow (Pycord-Development/pycord)

The Docs JSON Export workflow from Pycord-Development/pycord, 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: Pycord-Development/pycord.github/workflows/docs-json-export.ymlLicense MITView source

What it does

This is the Docs JSON Export workflow from the Pycord-Development/pycord 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: Docs JSON Export

on:
  push:
    branches:
      - master
  workflow_dispatch:

jobs:
  export-docs-json:
    name: Export docs.json
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        id: checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      - name: Set up Python
        uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
        id: setup-python
        with:
          python-version: "3.14"
          cache: "pip"
          cache-dependency-path: "requirements/docs.txt"
          check-latest: true
      - name: Install dependencies
        id: install-deps
        run: |
          python -m pip install -U pip
          pip install ".[docs,voice]"
          pip install beautifulsoup4
      - name: Build Sphinx HTML docs
        id: build-sphinx
        run: sphinx-build -b html docs docs/_build/html
      - name: Export docs.json
        id: generate-json
        run: python scripts/docs_json_exporter.py
      - name: Upload docs.json as artifact
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        id: artifact-upload
        with:
          name: Pycord Docs JSON
          path: docs.json
          retention-days: 1
      - name: Show docs.json summary
        run: |
          head -n 40 docs.json || tail -n 40 docs.json
      - name: Output artifact ID
        run: |
          echo "artifact-id=${{ steps.artifact-upload.outputs.artifact-id }}" >> $GITHUB_OUTPUT
          echo "artifact-url=${{ steps.artifact-upload.outputs.artifact-url }}" >> $GITHUB_OUTPUT
          echo "::notice::Artifact uploaded: ${{ steps.artifact-upload.outputs.artifact-url }}"

The same workflow, on Latchkey

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

name: Docs JSON Export
 
on:
  push:
    branches:
      - master
  workflow_dispatch:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  export-docs-json:
    timeout-minutes: 30
    name: Export docs.json
    runs-on: latchkey-small
    steps:
      - name: Checkout repository
        id: checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      - name: Set up Python
        uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
        id: setup-python
        with:
          python-version: "3.14"
          cache: "pip"
          cache-dependency-path: "requirements/docs.txt"
          check-latest: true
      - name: Install dependencies
        id: install-deps
        run: |
          python -m pip install -U pip
          pip install ".[docs,voice]"
          pip install beautifulsoup4
      - name: Build Sphinx HTML docs
        id: build-sphinx
        run: sphinx-build -b html docs docs/_build/html
      - name: Export docs.json
        id: generate-json
        run: python scripts/docs_json_exporter.py
      - name: Upload docs.json as artifact
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        id: artifact-upload
        with:
          name: Pycord Docs JSON
          path: docs.json
          retention-days: 1
      - name: Show docs.json summary
        run: |
          head -n 40 docs.json || tail -n 40 docs.json
      - name: Output artifact ID
        run: |
          echo "artifact-id=${{ steps.artifact-upload.outputs.artifact-id }}" >> $GITHUB_OUTPUT
          echo "artifact-url=${{ steps.artifact-upload.outputs.artifact-url }}" >> $GITHUB_OUTPUT
          echo "::notice::Artifact uploaded: ${{ steps.artifact-upload.outputs.artifact-url }}"
 

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