Schedule icon
Script icon
If icon
Load icon
Log icon
SlackIncomingWebhook icon

Export GitHub Stargazers to BigQuery

Export repo stargazers to BigQuery weekly, guard against empty pulls, and alert Slack on failures.

Categories
BusinessData

Star counts are vanity until you can slice them. This blueprint pulls a repository's stargazers — user and the date they starred — into BigQuery on a weekly schedule, so you can chart growth, cohort new stars, and join stargazers against signups or issues.

How it works

  1. fetch_stargazers (io.kestra.plugin.scripts.python.Script) pages through the GitHub stargazers API with a token, capped by max_pages, and writes stargazers.csv via the output directory protocol. Empty pages stop pagination early.
  2. check_results (io.kestra.plugin.core.flow.If) only proceeds when rows were actually fetched — an empty week logs a warning instead of truncating your table.
  3. load_to_bigquery (io.kestra.plugin.gcp.bigquery.Load) loads the CSV with WRITE_TRUNCATE into your destination table.
  4. The errors block alerts Slack on token rate limits or GCP permission failures.

What you get

  • A queryable stargazers BigQuery table refreshed weekly.
  • An empty-pull guard so a bad token never wipes history.
  • Slack alerts when the export breaks.

Who it's for

  • Developer advocates tracking GitHub growth in BigQuery alongside product analytics.
  • Open-source maintainers reporting stars at community events.
  • Growth teams correlating stars with launches.

Why orchestrate this with Kestra

The GitHub API gives you JSON; the flow turns it into a weekly, guarded, alerted table load — and the next step (join with signups, chart in Looker, alert on milestones) is one task away.

Prerequisites

  • A GitHub token (public repos work with a basic token).
  • A GCP service account with BigQuery data editor on the destination dataset.
  • A Slack webhook for failure alerts.

Secrets

  • GITHUB_TOKEN: token for the stargazers API.
  • GCP_SERVICE_ACCOUNT: JSON key for BigQuery load.
  • SLACK_WEBHOOK_URL: webhook for failure alerts.

Quick start

  1. Add the three secrets.
  2. Set repository, gcp_project_id, and bigquery_table.
  3. Run once and check export_count and the BigQuery table.
  4. Enable weekly_export.

How to extend

  • Append instead of truncate (WRITE_APPEND) and dedupe in SQL.
  • Add a milestone alert task when count crosses a threshold.
  • Fan out over multiple repos with a ForEach.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.