Skip to content

Instantly share code, notes, and snippets.

@MichaelCurrin
Last active December 24, 2022 23:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MichaelCurrin/b22f0d3c18d8529907d7bab17ae9d6d8 to your computer and use it in GitHub Desktop.
Save MichaelCurrin/b22f0d3c18d8529907d7bab17ae9d6d8 to your computer and use it in GitHub Desktop.
GitHub GraphQL - Get active repos

GitHub GraphQL - Get active repos

Get 100 repos owned by a user or org, with the most recently pushed repo first

If you have access to see the private repos of an org or user, you'll see those too.

Steps

  1. Go to the GraphQL API explorer:
  2. Sign in as your GitHub account.
  3. Paste query from query.gql.
  4. Include JSON data payload in Query Variables section - see params.json. Specify the name of a user or organization.
  5. Run query.

Sample output data

[
    {
        "name": "os-genesis",
        "pushedAt": "2020-06-23T21:31:05Z",
        "updatedAt": "2020-06-23T21:31:07Z",
        
        "isPrivate": false,
        "description": "Automate config and package management on a dev laptop"
    },
    {
        "name": "unicron",
        "pushedAt": "2020-06-23T11:17:30Z",
        "updatedAt": "2020-06-23T11:17:31Z",
        
        "isPrivate": false,
        "description": "A simple scheduler to ensure tasks run exactly once per day but get retried at intervals until the task passes :repeat_one: :hourglass_flowing_sand: :unicorn:",
        
    }
]
{ "login": "MichaelCurrin" }
query lastUpdatedRepos ($login: String!) {
repositoryOwner(login: $login) {
repositories(first: 100, orderBy: {field: PUSHED_AT, direction: DESC}) {
nodes {
name
pushedAt
updatedAt
isPrivate
description
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment