Skip to content

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

1.9 KB
Raw Blame
# Depot CI jobs call the GitHub API with an ambient installation token of the Depot Code
# Access app. Depot hands out tokens from more than one installation, each with its own hourly
# bucket, shared by every Depot CI job and by Depot's own check reporting, and GitHub Actions
# cannot read them. This workflow reads them from Depot jobs and emits the same
# `github_rate_limit_observed` event as .github/workflows/monitor-github-rate-limit.yml, with
# source `depot_ambient`, so the core-bucket alert in the DevEx project covers it.
# `installation_repositories` on each event tells the installations apart.
name: Monitor Depot ambient rate limit
on:
    schedule:
        # A bucket can run out within minutes of its hourly reset, so a slower poll misses it.
        - cron: '*/10 * * * *'
    workflow_dispatch:
permissions:
    contents: read
jobs:
    poll:
        name: Poll the Depot ambient token bucket
        # Each job draws its token independently, so several samplers per poll reach every installation.
        strategy:
            matrix:
                sampler: [1, 2, 3]
        runs-on: depot-ubuntu-24.04
        timeout-minutes: 3
        steps:
            - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
              with:
                  sparse-checkout: |
                      .github/scripts/monitor-github-rate-limit.js
                  sparse-checkout-cone-mode: false

            - name: Poll the Depot ambient token bucket and emit to PostHog
              uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
              env:
                  POSTHOG_DEVEX_PROJECT_API_TOKEN: ${{ secrets.POSTHOG_DEVEX_PROJECT_API_TOKEN }}
              with:
                  script: |
                      const script = require('./.github/scripts/monitor-github-rate-limit.js')
                      await script({ github, context, core }, { source: 'depot_ambient', probe: 'headers' })