:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(ci): reuse the built skills zip in the release job (#96954)
posthog[bot]179fe1659055
diff --git a/.github/workflows/ci-agent-skills.yml b/.github/workflows/ci-agent-skills.ymlindex a614c299752d..bc372cf7f1e2 100644--- a/.github/workflows/ci-agent-skills.yml+++ b/.github/workflows/ci-agent-skills.yml@@ -269,6 +269,17 @@ jobs:DEBUG: 1run: ./bin/hogli build:skills+ - name: Upload skills ZIP for the release job+ # release-skills publishes this exact artifact, so it does not repeat the+ # Postgres, Rust, and sqlx setup that produces it.+ if: github.event_name == 'push' && github.ref == 'refs/heads/master'+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0+ with:+ name: agent-skills-zip+ path: products/posthog_ai/dist/skills.zip+ if-no-files-found: error+ retention-days: 7+current-master:name: Check current masterruns-on: ubuntu-latest@@ -299,167 +310,26 @@ jobs:release-skills:name: Release agent skillsruns-on: ubuntu-latest- timeout-minutes: 30+ timeout-minutes: 10needs: [check-skills, current-master]if: github.repository_owner == 'PostHog' && github.ref == 'refs/heads/master' && needs.current-master.outputs.is-current == 'true'permissions:contents: write- env:- DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USER }}- DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}steps:+ # The version step below only needs the origin remote for `git ls-remote`, so+ # nothing of the tree has to be materialized.- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2-- - name: Compute schema cache key- id: schema-key- # The pushed commit is checked out directly, so the migration-set key is- # HEAD's. It matches the dump the previous master push saved unless this- # push itself changed the migration set; a miss falls through to the full- # migrate below, so an absent key is never a correctness risk.- env:- # Manual cache-bust knob. Keep in sync with SCHEMA_CACHE_EPOCH in- # ci-backend.yml, which saves these caches on master pushes.- SCHEMA_CACHE_EPOCH: v2- run: |- # Must match ci-backend.yml's save-side computation byte for byte or the key never hits.- MIG_FILES=$(git ls-tree -r --format='%(objectname) %(path)' HEAD \- | grep -E '/migrations/[^/]+\.py$|^[0-9a-f]+ uv\.lock$' \- | grep -vE '/(clickhouse|async_migrations)/migrations/' \- | LC_ALL=C sort) || true- # Routing decides which app labels are in the dump, so these inputs belong in the key.- DB_ROUTING=$(git ls-tree -r --format='%(objectname) %(path)' HEAD -- products/db_routing.yaml posthog/product_db_config.py posthog/product_db_router.py)- PG_IMAGE=$(git show "HEAD:docker-compose.base.yml" 2>/dev/null \- | grep -m1 -E '^[[:space:]]*image:[[:space:]]*postgres:' | tr -d '[:space:]')- if [ -z "$MIG_FILES" ]; then- echo "migrations_key=" >> $GITHUB_OUTPUT- echo "::notice::no migration files matched, so migrate runs from scratch"- else- MIG_HASH=$(printf '%s\n%s\n%s' "$MIG_FILES" "$PG_IMAGE" "$DB_ROUTING" | sha256sum | cut -c1-40)- echo "migrations_key=posthog-schema-mig-${SCHEMA_CACHE_EPOCH}-${MIG_HASH}" >> $GITHUB_OUTPUT- fi- # Last-resort restore prefix: matches the newest saved dump when the exact- # key misses. Gated on checkout age because a re-run of an old commit could- # restore a dump newer than its code, which forward-only migrate cannot repair.- HEAD_AGE_SECONDS=$(( $(date +%s) - $(git show -s --format=%ct HEAD) ))- if [ "$HEAD_AGE_SECONDS" -lt 86400 ]; then- echo "prefix_key=posthog-schema-mig-${SCHEMA_CACHE_EPOCH}-" >> $GITHUB_OUTPUT- fi-- - name: Log in to Docker Hub- continue-on-error: true- if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}- uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0with:- username: ${{ vars.DOCKERHUB_USER }}- password: ${{ secrets.DOCKERHUB_TOKEN }}-- - name: Start Docker services- env:- COMPOSE_FILE: docker-compose.dev.yml:docker-compose.profiles.yml- WAIT_FOR_DOCKER_LAUNCH_RETRIES: 3- run: |- bin/ci-wait-for-docker launch --down-- - name: Mint setup-action GitHub token- id: setup-gh-token- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository- continue-on-error: true- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1- with:- client-id: ${{ vars.GH_APP_POSTHOG_SETUP_ACTIONS_APP_ID }}- private-key: ${{ secrets.GH_APP_POSTHOG_SETUP_ACTIONS_PRIVATE_KEY }}- skip-token-revoke: true-- - name: Set up Python- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0- with:- python-version-file: 'pyproject.toml'- token: ${{ steps.setup-gh-token.outputs.token || github.token }}-- - name: Install uv- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0- with:- version: '0.11.28' # pinned: unpinned setup-uv calls GH API on every job, exhausts rate limit- enable-cache: true- cache-dependency-glob: uv.lock- save-cache: false-- - name: Install python dependencies- run: UV_PROJECT_ENVIRONMENT=$pythonLocation uv sync --frozen --dev+ sparse-checkout: .github/workflows/ci-agent-skills.yml+ sparse-checkout-cone-mode: false+ filter: blob:none- - name: Install Rust- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9+ - name: Download skills ZIP built by check-skills+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0with:- toolchain: stable- components: cargo-- - name: Install sqlx-cli- uses: ./.github/actions/setup-sqlx-cli-- - name: Wait for Docker services- env:- COMPOSE_FILE: docker-compose.dev.yml:docker-compose.profiles.yml- WAIT_FOR_DOCKER_LAUNCH_RETRIES: 3- run: bin/ci-wait-for-docker wait-- - name: Restore schema cache from master- if: steps.schema-key.outputs.migrations_key != ''- uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3- with:- path: schema.sql.gz- key: ${{ steps.schema-key.outputs.migrations_key }}- restore-keys: |- ${{ steps.schema-key.outputs.prefix_key }}-- - name: Prime posthog from cached schema- # db:restore-schema-fresh restores the dump and seeds the RunPython data a- # schema-only dump lacks; the migrate step below layers anything newer on- # top. On failure it leaves a fresh empty db, so migrate runs the full history.- env:- SECRET_KEY: '6b01eee4f945ca25045b5aab440b953461faf08693a9abbf1166dc7c6b9772da'- DATABASE_URL: 'postgres://posthog:posthog@localhost:5432/posthog'- REDIS_URL: 'redis://localhost'- OBJECT_STORAGE_ENABLED: 'False'- TEST: 1- DEBUG: 1- TARGET_DB: posthog- run: |- if [ ! -f schema.sql.gz ]; then- echo "::notice::Schema cache miss, so the migrate step below runs the full history"- exit 0- fi- mkdir -p .postgres-backups- mv schema.sql.gz .postgres-backups/schema-latest.sql.gz- if ! ./bin/hogli db:restore-schema-fresh; then- echo "::warning::Schema restore failed (stale or incompatible cached dump?), so the migrate step below runs the full history"- fi-- - name: Run migrations and create test data- env:- SECRET_KEY: '6b01eee4f945ca25045b5aab440b953461faf08693a9abbf1166dc7c6b9772da'- DATABASE_URL: 'postgres://posthog:posthog@localhost:5432/posthog'- REDIS_URL: 'redis://localhost'- OBJECT_STORAGE_ENABLED: 'False'- TEST: 1- DEBUG: 1- run: |- DATABASE_URL="postgres://posthog:posthog@localhost:5432/posthog_persons" \- sqlx database create- DATABASE_URL="postgres://posthog:posthog@localhost:5432/posthog_persons" \- sqlx migrate run --source rust/persons_migrations/- python manage.py migrate --noinput- python manage.py setup_dev --no-data-- - name: Build skills ZIP- env:- SECRET_KEY: '6b01eee4f945ca25045b5aab440b953461faf08693a9abbf1166dc7c6b9772da'- DATABASE_URL: 'postgres://posthog:posthog@localhost:5432/posthog'- REDIS_URL: 'redis://localhost'- OBJECT_STORAGE_ENABLED: 'False'- TEST: 1- DEBUG: 1- run: ./bin/hogli build:skills+ name: agent-skills-zip+ path: products/posthog_ai/dist- name: Determine next versionid: version