GitHub repositories in an organization
Lists every repository in a GitHub organization with the fields that answer most governance asks: visibility, archive state, fork status, default branch and last-push recency. The repository filter is applied server-side by the API rather than in SQL, so narrow the result with repo_type instead of filtering the full list client-side.
Query
SELECT
name,
full_name,
visibility,
archived,
fork,
default_branch,
pushed_at,
stargazers_count,
open_issues_count
FROM github.repos.repos
WHERE org = '{{org}}'
AND type = '{{repo_type}}'
AND per_page = 100;
Variation: least recently pushed first
sort and direction are server-side parameters, so the API returns the rows already ordered - useful for finding abandoned repositories:
SELECT name, visibility, archived, pushed_at, stargazers_count
FROM github.repos.repos
WHERE org = '{{org}}'
AND sort = 'pushed'
AND direction = 'asc'
AND per_page = 100;
Variation: staleness in days
Compute an age from pushed_at and exclude archived repositories, which are stale by design:
SELECT name, pushed_at, days_since_push FROM (
SELECT name, pushed_at, archived,
ROUND(julianday('now') - julianday(pushed_at)) as days_since_push
FROM github.repos.repos
WHERE org = '{{org}}'
AND per_page = 100
) t WHERE archived = 0;
Notes
Predicate pushdown is not wired for this provider, so a WHERE clause on an output column such as visibility or fork is applied client-side after every page has been fetched. Use the API's own filter parameters where they exist: type accepts all, public, private, forks, sources and member, and sources excludes forks server-side. sort accepts created, updated, pushed and full_name, with direction asc or desc. Pagination is wired: per_page sets the page size only, and stackql follows the pagination links and returns every repository regardless of the value, so per_page = 100 minimises requests rather than capping results. Unauthenticated calls see only public repositories and are heavily rate limited; authenticate with a personal access token as STACKQL_GITHUB_PASSWORD to see private and internal repositories. Boolean columns compare as 1 and 0, not the strings true and false.