Scripts and CI
Use gitpanda in scripts, cron jobs and CI pipelines with API keys.
gitpanda works the same without a terminal: no prompts, no colors, clear exit codes.
Make a key#
In OkayPanda: GitPanda → ⌨ Command line → Use an API key instead. Give it a name you'll recognize ("CI docs export"), the fewest scopes it needs (Read to export; Work to push or start goals), and store it as a secret in your CI.
Use it with GITPANDA_KEY. Nothing is saved to disk.
GitHub Actions#
yaml
name: Export company docs
on:
schedule: [{ cron: "0 6 * * *" }] # every morning
workflow_dispatch:
jobs:
export:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with: { node-version: 20 }
- run: curl -fsSL https://gitpanda.ai/install.sh | sh
- run: |
~/.local/bin/gitpanda clone acme docs
ls docs/marketing/docs
env:
GITPANDA_KEY: ${{ secrets.OKAYPANDA_KEY }}Push generated docs back#
export GITPANDA_KEY=opk_… # a key with read and work
gitpanda clone acme work && cd work
./generate-release-notes > docs/release-notes.md
gitpanda sync -m "Release notes for $(date +%F)"Start work from a script#
gitpanda goal "Summarize this week's support tickets into a one-page report" --room customer-supportIt returns as soon as the goal starts. Add --watch to wait for it to finish (up to an hour), then
gitpanda files G-<n> --out reports/ to collect what it made.
Cron#
cron
# Every weekday at 8, pull the latest into a shared folder
0 8 * * 1-5 cd /srv/acme && GITPANDA_KEY=opk_… /home/me/.local/bin/gitpanda pull >> /var/log/gitpanda.log 2>&1Exit codes#
| Code | Meaning |
|---|---|
0 |
Success. |
1 |
Failure; the reason is on stderr. Includes conflicts on push. |
2 |
Unknown command. |
Tips#
- Set
GITPANDA_NO_UPDATE=1in CI to skip the daily version check. - Pin a version:
curl -fsSL https://gitpanda.ai/install.sh | GITPANDA_VERSION=2.3.0 sh, or downloadhttps://gitpanda.ai/releases/gitpanda-2.3.0.mjs(every release from 2.3.0 on is kept there). - For anything gitpanda doesn't do, call the API directly with the same key.