Skip to content
Latchkey

How to Aggregate CI Status Across Multiple Repositories

Aggregating status means querying each repo latest run via the API and summarizing the conclusions, giving one health view over a polyrepo.

A scheduled job loops over the repos, fetches the latest run conclusion for each with gh api, and prints or posts a rollup. Fail the job if any repo default branch is red.

Steps

  • List the repos to monitor.
  • For each, query the latest run on the default branch.
  • Summarize the conclusions and flag any failures.

Status rollup workflow

.github/workflows/status.yml
on:
  schedule:
    - cron: '*/30 * * * *'
jobs:
  status:
    runs-on: ubuntu-latest
    steps:
      - env:
          GH_TOKEN: ${{ secrets.CROSS_REPO_PAT }}
        run: |
          fail=0
          for repo in api web worker; do
            c=$(gh api "/repos/my-org/$repo/actions/runs?branch=main&per_page=1" \
              --jq '.workflow_runs[0].conclusion')
            echo "$repo: $c"
            [ "$c" = "success" ] || fail=1
          done
          exit $fail

Gotchas

  • A null conclusion means the run is still in progress, not a failure; handle it explicitly.
  • Rate limits apply when scanning many repos frequently; widen the schedule if you hit them.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →