Skip to main content

GitHub Actions Fleet Indexer

The GitHub Actions workflow (github-batho.yaml) automatically indexes your repository on every push and pull request to main, using an incremental patching strategy to keep CI cycles fast.

Workflow

Full Workflow YAML

Copy the following into .github/workflows/batho-ci.yml:

name: Batho Fleet Indexer

on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
group: batho-fleet-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
update-code-graph:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
actions: read # Required to download previous artifacts
contents: read # Required to checkout code

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Batho
run: pip install batho

- name: Download Previous Batho Artifact
# Fetches the artifact from the last successful run on this branch
uses: dawidd6/action-download-artifact@v6
continue-on-error: true # Will fail on the very first run, which is expected
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: batho-ci.yml # MUST match the filename of this yaml file
branch: ${{ github.ref_name }}
name: batho-database
path: .

- name: Run Batho (Patch or Build)
run: |
# Batho stores the code graph as Arrow IPC files packed into artifact_<dirname>.batho
if ls artifact_*.batho 1> /dev/null 2>&1; then
echo "✅ Found existing Batho artifact. Running incremental patch..."
batho load --root . artifact_*.batho --force
batho patch --root . --verbose
else
echo "⚠️ No existing artifact found. Running full build..."
batho build --root . --full --verbose
fi
# Export the updated .batho/ bundle into a transport artifact
batho export --root .

- name: Upload Updated Artifact
uses: actions/upload-artifact@v4
with:
name: batho-database
path: artifact_*.batho
retention-days: 90

Key Configuration

KeyValuePurpose
Triggerspush + pull_request to mainRun on every commit and PR
Concurrencycancel-in-progress: truePrevent redundant overlapping runs
Timeout30 minutesFail fast if something hangs
Runnerubuntu-latestStandard GitHub-hosted runner
Permissionsactions: read, contents: readMinimal permissions principle
Installpip install bathoPulls latest stable from PyPI
Artifact namebatho-databaseConsistent across runs for reliable downloads
Retention90 daysLong enough for agent access

First-Run Behavior

On the very first run there is no previous artifact, so the download step fails gracefully (continue-on-error: true) and the workflow falls through to a full batho build --full.

AI Agent Access

Agents can download and restore the graph:

# Download latest artifact from main branch
gh api \
/repos/{owner}/{repo}/actions/artifacts \
--jq '.artifacts[] | select(.name=="batho-database") | .id' \
| xargs -I {} gh api \
/repos/{owner}/{repo}/actions/artifacts/{}/zip \
--output batho-database.zip
unzip batho-database.zip

# Restore the Arrow IPC graph store
batho load --root . artifact_*.batho

Troubleshooting

IssueCauseResolution
Artifact download failsFirst run (no previous artifact)Expected — workflow continues with full build
Workflow filename mismatchworkflow parameter doesn't match actual filenameEnsure workflow: batho-ci.yml matches your file
batho load failsSchema version mismatchDelete artifact to trigger full rebuild
Build timeoutVery large repositoryIncrease timeout-minutes or split into multiple jobs