Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: support "events" #64

Open
khimaros opened this issue Jun 14, 2021 · 5 comments
Open

feature: support "events" #64

khimaros opened this issue Jun 14, 2021 · 5 comments

Comments

@khimaros
Copy link

the GitHub API provides the ability to fetch all events for a given user, organization, or repository: https://docs.github.com/en/rest/reference/activity#list-events-for-the-authenticated-user

this would allow users to export all of the issue comments, new issues, etc. that they created. something which is currently missing from the GitHub takeout exports.

@khimaros
Copy link
Author

khimaros commented Jun 14, 2021

i have a basic working version at https://github.com/khimaros/github-to-sqlite

this can be tested with github-to-sqlite events.db khimaros/events

caveat: the GitHub API doesn't seem to provide a complete history of events.

@khimaros
Copy link
Author

it looks like the v4 GraphQL API is the only way to get data beyond 90 days from GitHub.

this is significant change, but may be worth considering in the future.

@simonw
Copy link
Collaborator

simonw commented Jun 14, 2021

Have you found a way to access events in GraphQL? I can only see way to access a timeline of events for a single issue or a single pull request. See also https://github.saobby.my.eu.orgmunity/t/get-event-equivalent-for-v4/13600/2

@simonw
Copy link
Collaborator

simonw commented Jun 14, 2021

I'm definitely interested in supporting events in this tool - see #14.

@khimaros
Copy link
Author

@simonw -- i've created an omega-query that fetched most of what was interesting to me for a single user.

found by poking around in the "Explorer" tab in https://docs.github.com/en/graphql/overview/explorer

note: pagination is still required via first and last but it seems to allow unlimited history.

query MyQuery {
  __typename
  user(login: "<user>") {
    id
    pinnedItems(first: 100) {
      edges {
        node
      }
    }
    pullRequests(first: 100) {
      nodes {
        body
        title
        state
        createdAt
      }
    }
    createdAt
    issues(first: 100) {
      pageInfo {
        endCursor
        startCursor
      }
      nodes {
        title
        url
        createdAt
        body
      }
    }
    issueComments(first: 100) {
      edges {
        node {
          id
          updatedAt
          url
          body
        }
      }
    }
    repositories(first: 100) {
      nodes {
        createdAt
        description
        parent {
          name
        }
        pinnedIssues(first: 100) {
          edges {
            node {
              id
            }
          }
        }
        pinnedDiscussions(first: 100) {
          edges {
            node {
              id
            }
          }
        }
      }
    }
    starredRepositories(first: 100) {
      edges {
        node {
          id
        }
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants