cq-source-github

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

cq-source-github

Unofficial, community-maintained GitHub source plugin for CloudQuery. Not affiliated with or endorsed by CloudQuery.

Status: early release (v0.1.0). All 31 tables of the old CloudQuery GitHub plugin are implemented, plus 19 new GitHub Actions tables: see Tables.

Install

Each release publishes one zip per platform on the releases page, named cq-source-github_<os>_<arch>.zip, for linux, darwin and windows on amd64 and arm64, plus checksums.txt. Each zip contains only the plugin binary (cq-source-github, or cq-source-github.exe on Windows). The first release is v0.1.0.

go install github.com/slashben/cq-source-github@... does not work: go.mod carries a replace directive, which go install refuses for a module outside the current directory. Use the release zips, or clone the repository and run make build.

Download the zip for your platform from the releases page and unzip it (or clone the repository and run make build), and point path: at the binary:

kind: source
spec:
  name: github
  registry: local
  path: /opt/cq/cq-source-github
  version: v0.1.0
  tables: ["github_organizations", "github_repositories"]
  destinations: ["postgresql"]
  spec:
    access_token: "${GITHUB_TOKEN}"
    orgs: ["my-org"]
GitHub registry

The CloudQuery CLI can also download the plugin from a tagged GitHub release. This needs a published release with the version: tag, and the repository must be public: the CLI downloads the release asset with plain, unauthenticated requests, so no token makes a private repository work. For how a release is cut, see Releasing:

kind: source
spec:
  name: github
  registry: github
  path: slashben/github
  version: v0.1.0
  # ...

The CLI resolves this to the slashben/cq-source-github repository and the asset cq-source-github_<os>_<arch>.zip. Note that the CLI marks registry: github as deprecated and prints a warning; prefer the local binary.

Configuration

All keys go under the source's spec: block. Keep secrets out of the file by using environment variable expansion such as "${GITHUB_TOKEN}".

Key Description
access_token Personal access token (or other token). Either this or app_auth is required.
app_auth List of GitHub App installations, one per organization (see below).
orgs Organizations to sync. Either orgs or repos is required.
repos Individual repositories, as owner/repo.
enterprise GitHub Enterprise Server settings: base_url and upload_url, both required.
concurrency Concurrent requests the scheduler may run. Default 1500.
discovery_concurrency Concurrent requests while discovering repositories. Default 1; a negative value means unlimited.
include_archived_repos Also sync archived repositories. Default false.
local_cache_path Directory used to cache HTTP responses between syncs (see below).
table_options.github_workflow_runs.created_since Only sync workflow runs created after this time: RFC3339, a date (2026-01-31), or a relative value such as 14 days ago.
table_options.github_workflow_runs.max_lookback Incremental sync only: unfinished runs created longer ago than this stop being refetched, as <N> days or <N> hours. Default 35 days.

app_auth entries take org, app_id, installation_id, and exactly one of private_key (the PEM contents) or private_key_path.

Local cache

local_cache_path keeps GitHub's responses on disk so later syncs can revalidate them instead of downloading them again. Before setting it:

  • Do not share one directory between customers or between sets of credentials. Each credential gets its own subdirectory, but the directory as a whole holds every credential's data.
  • It holds GitHub's full API responses for the tables you sync, not only metadata, so protect it like the destination. Files are created readable only by the user running the plugin. Two kinds of request are the exception: they are requested with Cache-Control: no-store, so their responses are never written to or served from the cache. They are the Actions variables listings (organization, repository and environment), so variable values never reach the cache, and the SBOM requests of github_repository_sboms, so the redirect that carries the report's pre-signed download URL is never stored and a "not ready yet" answer is never replayed.
  • Only responses from the API host (api.github.com, or the enterprise base_url) are cached; requests to any other host bypass the cache, such as a download host that GitHub redirects to and, on github.com, the upload host.
  • Nothing is ever evicted; remove old entries yourself if the directory grows too large.
  • No token or private key is written to it. For an access token, the cache stores a SHA-256 hash of the token as the credential's identity; for an App, the app and installation IDs.
Personal access token

See examples/token.yml:

spec:
  access_token: "${GITHUB_TOKEN}"
  orgs: ["my-org"]
GitHub App

See examples/app-hourly.yml, examples/app-frequent.yml and examples/app-catchup.yml:

spec:
  app_auth:
    - org: my-org
      app_id: "${GITHUB_APP_ID}"
      installation_id: "${GITHUB_INSTALLATION_ID}"
      private_key_path: "${GITHUB_APP_PRIVATE_KEY_PATH}"
  orgs: ["my-org"]

The App examples are meant for different cadences: app-hourly.yml for slow-changing tables (organizations, repositories, workflows, the Actions tables and the other tables of the table list, except github_issues, github_hook_deliveries, github_repository_sboms and github_external_groups, which it leaves out on purpose) and app-frequent.yml for workflow runs and jobs. Run them as separate cloudquery sync invocations on different schedules (for example hourly and every few minutes). With incremental sync, also run app-catchup.yml daily (see Known limitation). Each defines a differently named source, because one file cannot hold two sources with the same name. In every example, replace the destination version: placeholder (VERSION_DESTINATION_POSTGRESQL) with a real release of the destination.

The examples use the PostgreSQL destination from registry: cloudquery, which needs a CloudQuery login (cloudquery login) to download. Any destination works: swap in another one, or one you have locally with registry: local.

Rate limits and retries

When GitHub answers a request with a primary rate limit (no requests left until the reset time) or a secondary rate limit, the plugin logs GitHub rate limit reached; waiting before retrying and pauses every request of that credential until the limit resets (a secondary limit without a reset time is waited out for a minute), then resumes gradually: one request first, then twice as many at a time after each round that succeeds. The pause is per credential, not per table or endpoint: the access token is one credential for every organization that uses it, and each app_auth entry is one credential for its organization. The plugin does not tell GitHub's rate-limit resources apart, so a limit reached on an endpoint with its own, smaller allowance also pauses every other table synced with that credential, until that allowance resets. The other requests wait without a warning of their own (they log waiting for GitHub rate limit to reset at debug level). A request is retried at most 5 times for a rate limit and sent at most 10 times in all; then its error is returned.

GET requests answered with 500, 502, 503 or 504, or failing without a response, are retried up to 3 times, after 1, 2 and 4 seconds (see Cost for the details). A GET that keeps failing this way therefore costs about 7 seconds of waiting before its error is returned. That cost is paid once per request, so it multiplies where a table makes one request per row: the per-row lookups (membership of the member tables, protection of github_repository_branches, and the request and response of each hook delivery) and, in incremental mode, the runs fetched one by one by ID.

Tables

The plugin has 50 tables. 31 of them are the tables of the old CloudQuery GitHub plugin (marked "no" in the last column); the other 19 are new (the Actions tables). Scope says what a parent-less table fans out over: organization tables get one sync per organization, repository tables one per repository (a child has its parent's scope). Permission is the GitHub App permission the table needs, spelled as in the plugin's skip warnings.

"Requests per sync" counts requests per organization, repository or parent row, and "per page" means one request per 100 rows. A table whose permission is missing is skipped with a warning and still costs one denied request per organization or repository per sync, so leave the tables you cannot read out of the config, and for a large organization list the tables you need in tables: instead of using "*".

Table Parent Scope A row is Permission Requests per sync New
github_organizations - organization one organization Metadata: read 1 per organization no
github_organization_members github_organizations organization one member of an organization, with the membership Organization members: read 1 per page, plus 1 per member for the membership no
github_organization_dependabot_alerts github_organizations organization one Dependabot alert of an organization Organization Dependabot alerts: read 1 per page no
github_organization_dependabot_secrets github_organizations organization one Dependabot secret (name and metadata only — never the secret's value) Organization Dependabot secrets: read 1 per page no
github_repositories - repository one repository Metadata: read none (rows come from repository discovery at startup) no
github_repository_branches github_repositories repository one branch, with its protection Repository contents: read 1 per page, plus 1 per protected branch no
github_repository_keys github_repositories repository one deploy key Repository administration: read 1 per page no
github_repository_sboms github_repositories repository one SBOM report of a repository Repository contents: read (and the dependency graph enabled) 2 or more per repository, plus a wait of up to about 30 seconds no
github_releases github_repositories repository one release (drafts and prereleases included) Repository contents: read 1 per page no
github_release_assets github_releases repository one asset of a release Repository contents: read 1 per page, per release that has assets no
github_repository_dependabot_alerts github_repositories repository one Dependabot alert of a repository Repository Dependabot alerts: read 1 per page no
github_repository_dependabot_secrets github_repositories repository one Dependabot secret (name and metadata only — never the secret's value) Repository Dependabot secrets: read 1 per page no
github_workflows - repository one workflow, with its file Actions: read 1 per page, plus 1 per workflow for its file no
github_workflow_runs - repository one workflow run Actions: read 1 per page (less with incremental sync) no
github_workflow_jobs github_workflow_runs repository one job of a run Actions: read 1 per page, per run no
github_workflow_run_usage github_workflow_runs repository the billable usage of a run (one row per run) Actions: read 1 per run no
github_organization_runners - organization one self-hosted runner of an organization Organization self-hosted runners: read 1 per page yes
github_repository_runners - repository one self-hosted runner of a repository Repository administration: read 1 per page yes
github_organization_hosted_runners - organization one GitHub-hosted runner of an organization Organization administration: read 1 per page yes
github_organization_runner_groups - organization one runner group of an organization Organization self-hosted runners: read 1 per page yes
github_organization_runner_group_runners github_organization_runner_groups organization one runner in a group Organization self-hosted runners: read 1 per group yes
github_organization_runner_group_repositories github_organization_runner_groups organization one repository a group is limited to Organization self-hosted runners: read 1 per group with visibility: selected; none for other groups yes
github_organization_actions_permissions - organization the organization's Actions policy (one row) Organization administration: read up to 3 per organization yes
github_repository_actions_permissions - repository the repository's Actions policy (one row) Repository administration: read up to 3 per repository yes
github_organization_actions_secrets - organization one Actions secret of an organization (name and metadata only — never the secret's value) Organization secrets: read 1 per page yes
github_repository_actions_secrets - repository one Actions secret of a repository (name and metadata only — never the secret's value) Repository secrets: read 1 per page yes
github_organization_actions_variables - organization one Actions variable of an organization, with its value Organization variables: read 1 per page yes
github_repository_actions_variables - repository one Actions variable of a repository, with its value Repository variables: read 1 per page yes
github_environments - repository one deployment environment Actions: read 1 per page yes
github_environment_secrets github_environments repository one secret of an environment (name and metadata only — never the secret's value) Repository environments: read 1 per environment yes
github_environment_variables github_environments repository one variable of an environment, with its value Repository environments: read 1 per environment yes
github_artifacts - repository one workflow-run artifact (metadata only; expired ones included) Actions: read 1 per page yes
github_actions_caches - repository one Actions cache entry Actions: read 1 per page yes
github_organization_oidc_subject_claims - organization the organization's OIDC subject-claim template (one row) Organization administration: read 1 per organization yes
github_repository_oidc_subject_claims - repository the repository's OIDC subject-claim template (one row) Actions: read 1 per repository yes
github_teams - organization one team Organization members: read 1 per page no
github_team_members github_teams organization one member of a team, with the membership Organization members: read 1 per page, per team, plus 1 per member for the membership no
github_team_repositories github_teams organization one repository of a team Organization members: read 1 per page, per team no
github_hooks - organization one webhook of an organization Organization webhooks: read 1 per page no
github_hook_deliveries github_hooks organization one delivery of a webhook Organization webhooks: read 1 per page, per hook, plus 1 per delivery for its full record no
github_installations - organization one app installation of an organization Organization administration: read 1 per page no
github_external_groups - organization one external group Organization members: read 1 per page no
github_billing_action - organization the organization's Actions billing (one row) Organization administration: read 1 per organization no
github_billing_package - organization the organization's packages billing (one row) Organization administration: read 1 per organization no
github_billing_storage - organization the organization's shared storage billing (one row) Organization administration: read 1 per organization no
github_issues - repository one issue or pull request Repository issues: read 1 per page no
github_traffic_clones - repository the repository's clone counts of the last 14 days (one row) Repository administration: read 1 per repository no
github_traffic_views - repository the repository's page views of the last 14 days (one row) Repository administration: read 1 per repository no
github_traffic_paths - repository one popular path of a repository Repository administration: read 1 per repository no
github_traffic_referrers - repository one referrer of a repository Repository administration: read 1 per repository no

Every sync is a full fetch, except for github_workflow_runs with incremental sync. github_hook_deliveries and github_issues can be very large.

Listing child tables

A child table is synced only when it is listed in tables: (or matched by a pattern such as "*") together with its parent, because the CLI's skip_dependent_tables defaults to true; set skip_dependent_tables: false on the source to sync every child of a listed parent. This applies to every child in the table above, including github_workflow_jobs and github_workflow_run_usage. The examples list the children of every parent they list, except three they leave out on purpose because each is expensive on every sync: github_workflow_run_usage (one extra request per run), github_hook_deliveries (one extra request per delivery) and github_repository_sboms (a wait of up to about 30 seconds per repository; see SBOMs).

Permissions

Permissions the GitHub App needs, for the tables you sync:

Permission Used by
Metadata: read Organizations and repositories (and repository discovery)
Actions: read Workflows, runs and their children, environments, artifacts, caches, repository OIDC subject claims
Repository contents: read Branches, releases, SBOMs; also the contents and contents_as_json columns of github_workflows (null without it)
Organization members: read Organization members, teams and their children, external groups
Organization Dependabot alerts: read Organization Dependabot alerts
Organization Dependabot secrets: read Organization Dependabot secrets
Organization self-hosted runners: read Organization runners and runner groups
Organization administration: read Hosted runners, organization Actions permissions, organization OIDC subject claims, installations, billing
Organization webhooks: read Hooks and deliveries
Organization secrets: read Organization Actions secrets
Organization variables: read Organization Actions variables
Repository administration: read Repository runners, repository Actions permissions, keys, traffic
Repository issues: read Issues
Repository Dependabot alerts: read Repository Dependabot alerts
Repository Dependabot secrets: read Repository Dependabot secrets
Repository environments: read Environment secrets and variables
Repository secrets: read Repository Actions secrets
Repository variables: read Repository Actions variables

The permission names are the ones the plugin reports in its skip warnings. The tables that returned rows in the real-API run described in Known limitations ran under a real GitHub App with the permissions listed here for them; the permission names of the other tables are checked only against the fake GitHub used by the tests, so compare them with what GitHub shows when you configure the App. A table whose permission is missing is skipped with a warning; it does not fail the sync.

A table the credentials cannot read is skipped with a warning, logged once per organization, table and HTTP status (a later skip of the same table with a different status, such as 404 after 403, is warned about too; other skips are logged at debug level); at the end of the sync one info line per table and organization gives the number of skips, when more than one. The count is of skips, not of repositories: one per repository for a repository table, one per run for github_workflow_jobs and github_workflow_run_usage, one per environment for the environment child tables and one per runner group for the runner group child tables. A child listing dropped because its parent answered 404 (the team, hook, release, workflow run, environment or runner group was deleted during the sync) yields no rows and no warning, but is counted: at the end of the sync one info line per table and organization, child listings dropped because the parent was gone, gives the count, even when it is one. An App installed on a personal account works for repositories, workflows and runs; for a user account, github_organizations and the organization-scoped tables return no rows and are skipped with a warning, without failing the sync.

Notes on the tables
Workflow tables
  • github_workflows: contents is the workflow file's text, contents_as_json the same file as JSON. One extra request per workflow.
  • github_workflow_runs is the parent of github_workflow_jobs and github_workflow_run_usage (one extra request per run).

Differences from the old CloudQuery plugin's tables:

  • In contents_as_json the trigger key stays "on". The old plugin's converter turned it into "true". This is deliberate.
  • A workflow whose html_url ref contains a / (for example a branch feature/x) gets null contents and contents_as_json, as in the old plugin. Only the first segment of the ref (feature) is used, so if a ref with that name exists, the contents come from that ref instead.
  • github_workflow_runs has an extra path column (the workflow file's path). Other columns GitHub adds to a run are kept as well.
Actions tables

These tables cover how GitHub Actions is set up: runners, policies, secrets and variables, environments, artifacts and caches. Secret tables hold names and metadata only; secret values are never requested and cannot be read through the API. Variable values are stored in the value column, so do not sync the variables tables to a destination that is less protected than the variables themselves.

Cost: the repository-scoped Actions tables together cost about ten requests per repository per sync, before paging, plus 2 per environment for the environment child tables (syncing both costs 1 request per repository plus 2 per environment). A repository with more than 100 artifacts, or a runner group with more than 100 runners, costs more than one request.

github_artifacts can be large: GitHub keeps artifacts for up to 90 days and a busy repository can have thousands. Only metadata is stored, never the artifact contents (expired artifacts are included).

Organization and repository children
  • github_organization_dependabot_secrets reads all pages of secrets (the old plugin read only the first).
  • A per-row lookup that GitHub denies (403 that is not a rate limit, or 404) leaves its column null and keeps the row: membership of github_organization_members and github_team_members, protection of github_repository_branches, and request and response of github_hook_deliveries (which keeps the listing's summary). The old plugin failed the row.
  • github_releases includes drafts and prereleases. Its columns make_latest, discussion_category_name and generate_release_notes exist as in the old schema but are always null.
  • github_hooks.config and the deliveries' request and response are stored as GitHub returns them and are never logged.
  • github_external_groups applies only to organizations with Enterprise Managed Users or team sync; GitHub may refuse it for other organizations, so the examples leave it out.
SBOMs

github_repository_sboms needs the dependency graph enabled on the repository. It uses GitHub's asynchronous SBOM flow (generate, then fetch, up to 6 attempts over about 30 seconds, which is the wait of up to about 30 seconds per repository), falling back to the legacy synchronous endpoint when generation answers 404 (older GitHub Enterprise Server). A report that is not ready in time is skipped with a warning and picked up by a later sync. A 404 from the legacy endpoint (dependency graph disabled) skips the table for that repository with a warning that mentions the dependency graph; the old plugin failed with an error.

Cost: the wait holds one of the sync's workers while GitHub builds the report, and the same few workers serve every other child table. With the default concurrency the table can add from a few minutes to a sync of a few hundred repositories to hours for thousands. Sync it in a separate, less frequent config (for example daily); the examples leave it out for this reason. A downloaded report larger than 64 MiB is a download error for that repository.

Billing tables

github_billing_action, github_billing_package and github_billing_storage each hold one row per organization. GitHub is retiring these endpoints: an organization on the new billing platform (the endpoint answers 404 or 410) gets zero rows and one warning per table saying the billing endpoint is unavailable. The rows are decoded into the plugin's own structs, so fractional values such as estimated_storage_for_month are stored as they are; the integer columns (days_left_in_billing_cycle, total_gigabytes_bandwidth_used, total_paid_gigabytes_bandwidth_used) are rounded to the nearest integer when GitHub sends a fraction.

Issues

github_issues holds every issue of every discovered repository, open and closed. GitHub lists pull requests as issues too, so they appear as rows, with the pull_request column set. A repository with issues disabled yields no rows and one debug line, not a warning. The table is a full fetch and can be very large, so the example hourly config leaves it out.

Traffic

github_traffic_clones, github_traffic_views, github_traffic_paths and github_traffic_referrers hold the last 14 days of repository traffic. Clones and views have one row per repository, with the daily breakdown in a JSON column; paths and referrers have one row per entry (GitHub returns at most 10). GitHub answers 403 unless the credential has push access, so those repositories are skipped with a warning.

Workflow runs and incremental sync

By default every sync lists all workflow runs of every repository (or those created since created_since). On a busy organization that is slow and uses a lot of API quota, so github_workflow_runs also supports incremental sync.

Enabling it

Add backend_options to the source, with a state table name and a connection to a destination that will hold the state:

kind: source
spec:
  name: github_frequent
  # ...
  tables: [github_workflow_runs, github_workflow_jobs]
  destinations: [postgresql]
  backend_options:
    table_name: cq_state_github_frequent
    connection: "@@plugins.postgresql.connection"
  spec:
    # ...
    table_options:
      github_workflow_runs:
        created_since: "7 days ago"
        max_lookback: "35 days"

A backend_options block that is present but empty enables incremental mode with nothing stored, so every sync is a first sync. Without backend_options there is no incremental mode.

What is stored

One state value per repository, under the key github_workflow_runs/org:<org>:repo:<owner>/<name>, as JSON:

  • the creation time of the newest run seen (the cursor);
  • the start time of the last successful listing, by GitHub's clock (the Date header of the first listing response) when available and not more than 5 minutes ahead of the local clock, else the local clock;
  • the ETag of the unfiltered first page of the runs listing, so an unchanged listing costs a conditional request that does not count against the rate limit;
  • the runs seen but not yet completed, each with its creation time and when it was last checked (the pending list);
  • the runs whose jobs or usage could not be fetched (the retry list), each with when it was first seen failing and when it was last refetched, and the runs given up on after their final attempt.

The repository's state is updated when its runs listing succeeded and the refetch by ID was not cancelled; a run that could not be fetched stays on its list. A child table (jobs or usage) that fails for a run also adds that run to the retry list, even when the rest of the sync fails. All state is saved only when the whole sync succeeds.

What a later sync fetches
  1. The runs listing, newest first, until a page reaches back before the cursor. A run is emitted if it was created at or after the cursor, or updated at or after the previous sync's start time.
  2. Every retry run and every pending run that is due (see below), by ID, unless the listing pages read already held it. These are emitted again, so their rows (and their jobs and usage) are refreshed.

A pending run seen in the listing pages read is refreshed from the listing. Otherwise it is refetched by ID only when due, by its age (from its creation): on every sync while it is under an hour old, at most once an hour while it is under a day old, and at most once every 6 hours after that. A run that is not due stays pending untouched. So a long-pending run that completes without appearing on the pages read can reach the destination up to 1 hour late (run under 24 hours old) or 6 hours late (older), plus one sync interval.

A retry run is refetched on every sync while its first failure is under an hour old, then at most once an hour. Once its first failure is over a day old, the next sync gives it a final attempt, however late that sync starts: the run is fetched and emitted once more, so its jobs and usage are fetched again. If they succeed, the run leaves the retry list; if they fail again (or the run itself cannot be fetched on that attempt), it is dropped from the retry list with one warning naming the run ID. The daily catch-up sync (below) refetches its jobs if the run is within its window.

A pending run stops being tracked when it completes, when GitHub reports it gone (404), or when it is older than max_lookback. 35 days is GitHub's maximum workflow run duration, so a run still unfinished after that will not change. created_since keeps bounding later syncs too: the cursor is never earlier than it, and moving it earlier later does not backfill older runs.

Cost
  • Each sync refetches by ID every run whose jobs or usage fetch failed and every unfinished run that is due, up to 1,000 of each per repository. Unfinished runs past the cap are dropped from the state with a warning; when 1,000 runs are already on the retry list, a new failure is not added (with a warning) and the runs already there are kept. Thanks to the backoff, a run waiting for days (for example on an environment approval) costs at most four requests a day, but a repository with hundreds of runs queued in the last hour costs that many requests per sync.
  • Each run emitted again also has its jobs (and usage) fetched again.
  • github_workflow_run_usage costs one extra request per run. Leave it out of the frequent config and sync it in the slower one.
  • If fetching a run by ID fails with an error other than 404, the sync logs a warning with the run ID and HTTP status, keeps the run on its list for the next sync and carries on; the repository's state still advances. A failed fetch counts as a check for the backoff below, so a pending run that keeps failing is retried on the same schedule as any other. A response that does not arrive in time is a failed fetch, not a failed sync. A failed retry-run fetch likewise counts as an attempt for the hourly retry schedule.
  • Any GET answered with 500, 502, 503 or 504, or failing without a response, is retried up to 3 times (after 1, 2 and 4 seconds) before the error counts, so a request that keeps failing waits about 7 seconds before its error is returned. Each run fetched by ID pays that wait on its own, so during a GitHub outage a sync with many retry or pending runs takes about 7 seconds per run longer. A successful response whose body breaks while being read (for example an HTTP/2 stream cancelled by GitHub, or fewer bytes than announced) is retried the same way, as a failed connection. A GET whose response headers do not arrive within 60 seconds is retried once only, since each such attempt has already waited a minute. If a page of a run's jobs still fails that way, the run's jobs listing is restarted once with 30 jobs a page, which costs about three times as many requests for that run.
Write modes

The destination must upsert by primary key (write_mode: overwrite). Re-emitted runs replace their earlier rows. Do not use a delete-stale write mode for the incremental source: it would delete every run that a sync did not emit again.

Known limitation

The runs listing is ordered by creation time, and a later sync reads it only down to the first page (100 runs) that reaches back before the cursor. Within the pages it reads, it emits every run created at or after the cursor and every run updated at or after the previous sync's start time. So incremental sync does not pick up:

  • a re-run of an old run, when that run sits below the pages read. Its updated_at changes, but the listing never reaches it, and it is not on the pending list because it had completed. A re-run of a recent run, or of a run that was unfinished at the last sync, is picked up;
  • a run that GitHub lists late, that is, one that appears with a creation time before the cursor and below the pages read, or one updated before the previous sync's start time;
  • a run deleted on GitHub. Its row stays in the destination (a deleted run that is still pending is only forgotten).

To correct for these, run a catch-up sync daily with a short window, created_since: "2 days ago": see examples/app-catchup.yml. Run it as a separate source with its own name (not the frequent source's name), without backend_options, and with write_mode: overwrite, which upserts and deletes nothing. Do not use overwrite-delete-stale (the CLI's default write mode): the catch-up emits only the runs in its window, so it would delete the rows it wrote earlier that have since left the window, and under the incremental source's name it would delete every row of that source that the catch-up did not emit again.

The catch-up costs one listing request per 100 runs in the window plus one jobs request for every run in the window, since it refetches jobs for each run whether or not it changed. On a busy organization, size the window to the gaps you expect to close; 2 days run daily overlaps each day once.

Example configurations: examples/app-frequent.yml (runs and jobs, incremental), examples/app-catchup.yml (runs and jobs, daily catch-up) and examples/app-hourly.yml (every table except runs, jobs, usage, issues, hook deliveries, SBOMs and external groups).

Known limitations

  • The plugin was run against the real GitHub API on 2026-11-18 with a GitHub App installed on one organization of 85 repositories. The workflows, runs, jobs and usage tables synced in full and incrementally, with state in SQLite. A sync of the other tables returned rows for organizations, organization members, repositories, branches, releases, release assets, workflows, artifacts, Actions caches, environments, repository OIDC subject claims and SBOMs (the asynchronous SBOM flow returned reports). The remaining tables were skipped with the permission warning, so their happy paths are verified only against the fake GitHub used by the tests, and their permission names in Permissions have not been checked against a live installation.
  • github_issues and github_hook_deliveries were never run against the real API; their requests and rows are verified only against the fake GitHub. Both are expensive: issues is a full fetch of every issue of every repository, and each hook delivery costs an extra request.
  • github_repository_sboms is expensive: each repository's report is built asynchronously and the wait holds one of the sync's workers for up to about 30 seconds (see SBOMs). The flow has been seen working on one organization only.
  • github_external_groups applies only to organizations with Enterprise Managed Users or team sync.
  • With incremental sync, a run whose jobs or usage could not be fetched is retried for 24 hours and then dropped from the retry list with a warning; its jobs stay missing until the daily catch-up sync refetches them, if the run is still within the catch-up's window (see Known limitation and Troubleshooting). In one narrow timing case a run is given up without a further attempt: when a retry of the run succeeds shortly before 24 hours after its first failure, the time of that first failure stays in the state until the next sync; if that next sync fetches the run again after the 24-hour mark (for example because it is still unfinished) and its jobs or usage fail before the sync has saved its state, the run is dropped at once with the same warning. Its jobs and usage then arrive with the daily catch-up sync.
  • One rate-limited request pauses every request of the same credential until the limit resets, whichever table made it and whichever of GitHub's rate-limit resources it counts against (see Rate limits and retries). A table whose endpoints have a smaller, separate allowance can hold up the whole sync for that credential.

Documentation

  • Table reference: one page per table with its columns and keys, generated from the code (make gen-docs; a test fails when it is out of date).
  • Running under a GitHub App: creating and installing the App, finding the IDs, permissions, cadences and rate limits.
  • Known limitations: what has and has not been run against the real API, and what is expensive.
  • Troubleshooting: skip warnings, rate-limit waits, retries, SBOMs, billing and resetting the incremental state.
  • Releasing: the owner's checklist for tagging and publishing a release.
  • Contributing: build, test, the fake GitHub, the parity rule and the clean-rewrite rule.
  • Security: reporting a vulnerability, what the plugin stores and what it never logs.

Development

make build   # builds ./cq-source-github with the version from git describe
make test
make gen-docs # regenerates docs/tables after a table change
make e2e     # needs E2E_ORG and a token or App; prints "skipped" without them
make e2e-all # syncs every table; same variables

make e2e builds the CloudQuery CLI and file destination from reference/ into a temporary directory, so no CloudQuery login is needed. It syncs the tables in E2E_TABLES (space-separated; default github_organizations github_repositories github_workflows) and requires rows from each. The generated spec limits workflow runs to the last 2 days, so add github_workflow_runs only for an organization with recent runs.

make e2e-all builds the same way and runs one sync of every table (tables: ["*"], skip_dependent_tables: false) into a local SQLite database, then prints table rows=<n> status=<ok|skipped|error> for each table and totals. skipped means the plugin logged a "skipping table" warning (GitHub denied access), which is expected for tables whose permission the App or token lacks; error means a table resolver failed. The first error line of each failed table is printed, cut to 300 characters. It exits 1 if any table has status error or github_repositories has no rows. E2E_SKIP_TABLES (comma-separated; default github_workflow_runs,github_workflow_jobs,github_workflow_run_usage,github_issues,github_hook_deliveries,github_repository_sboms) sets skip_tables, and E2E_CREATED_SINCE (default 1 day ago) bounds github_workflow_runs. scripts/e2e-all.sh --self-test checks the report step offline.

License: Apache-2.0.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package client holds the plugin configuration and (later) the GitHub client.
Package client holds the plugin configuration and (later) the GitHub client.
clienttest
Package clienttest fakes the GitHub API for tests.
Package clienttest fakes the GitHub API for tests.
internal/retrywait
Package retrywait holds the test override of the waits before the retries of a transient GitHub failure.
Package retrywait holds the test override of the waits before the retries of a transient GitHub failure.
spec/gen command
Command gen writes client/schema.json from the Spec type.
Command gen writes client/schema.json from the Spec type.
docs
gen command
Command gen writes the Markdown table reference: go run ./docs/gen docs/tables
Command gen writes the Markdown table reference: go run ./docs/gen docs/tables
Package parity checks that the plugin's tables keep the names, columns, column types and primary keys of the plugin they replace.
Package parity checks that the plugin's tables keep the names, columns, column types and primary keys of the plugin they replace.
gen command
Command gen builds parity/manifest.json from the markdown table docs of the plugin being reimplemented.
Command gen builds parity/manifest.json from the markdown table docs of the plugin being reimplemented.
tables
actions
Package actions holds the GitHub Actions tables.
Package actions holds the GitHub Actions tables.
billing
Package billing holds the organization billing tables.
Package billing holds the organization billing tables.
hooks
Package hooks holds the organization webhook tables: github_hooks and its child table github_hook_deliveries.
Package hooks holds the organization webhook tables: github_hooks and its child table github_hook_deliveries.
issues
Package issues holds the github_issues table.
Package issues holds the github_issues table.
organizations
Package organizations holds the github_organizations table.
Package organizations holds the github_organizations table.
repositories
Package repositories holds the github_repositories table.
Package repositories holds the github_repositories table.
teams
Package teams holds the organization team tables: github_teams and its child tables, github_team_members and github_team_repositories.
Package teams holds the organization team tables: github_teams and its child tables, github_team_members and github_team_repositories.
traffic
Package traffic holds the repository traffic tables.
Package traffic holds the repository traffic tables.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL