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 $failGotchas
- A
nullconclusion 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
How to Wait for a Downstream Workflow to Finish Across ReposAfter dispatching a workflow in another repository, poll its run status with gh run watch or the runs API so…
How to Use a Manifest Repo to Track Versions Across ReposKeep a manifest repository that records the pinned version of every service, so a release means updating one…