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

Repository creation date #2526

Closed
Androz2091 opened this issue Nov 9, 2019 · 12 comments · Fixed by #2560
Closed

Repository creation date #2526

Androz2091 opened this issue Nov 9, 2019 · 12 comments · Fixed by #2560
Labels
enhancement help wanted small Issues that new contributors can pick up

Comments

@Androz2091
Copy link

It would be nice if we could have a quick access to the repository creation date (to know if it's a recent or an old project).

Example URL:

github.com/user/repo

@sindresorhus
Copy link
Member

I sometimes needed this too. Where should it be shown if so?

@yakov116
Copy link
Member

@sindresorhus under the repo name

@sindresorhus
Copy link
Member

@yakov116 I disagree. It's not important enough to clutter up that area. It should be in a more subtle place.

@fregante
Copy link
Member

fregante commented Nov 10, 2019

I sometimes needed this too. Where should it be shown if so?

This should be possible with this query, but for some reason it requires a before cursor.

{
  repository(owner: "sindresorhus", name: "refined-github") {
    defaultBranchRef {
      target {
        ... on Commit {
          history(last: 1) {
            nodes {
              committedDate
            }
          }
        }
      }
    }
  }
}

history(first: 1) works without any other parameter (but it's the latest commit, not the first)

Otherwise we have to use the REST API and still use 2 queries. The first one includes a link to the last page, which will include the first commit.

@Androz2091
Copy link
Author

Androz2091 commented Nov 13, 2019

I don't know how the extension works, it was just a suggestion that I can't make myself but I see a created_at property when I use the REST API to get repository informations (for example https://api.github.com/repos/Androz2091/AtlantaBot) with only one query. Wouldn't it be better to use that?

Edit: Knowing that the first commit is not necessarily equal to the date of creation of the project, right?

@fregante fregante added small Issues that new contributors can pick up help wanted and removed under discussion labels Nov 13, 2019
@fregante
Copy link
Member

fregante commented Nov 13, 2019

I see a created_at property when I use the REST API

D'oh. Indeed. It should be pretty easy to implement then. Ideally this information should be found on the GraphQL API though; Only as a last resort we should use the REST API.

Knowing that the first commit is not necessarily equal to the date of creation of the project, right?

Technically I'd say that the first commit is the birth of the project. I think created_at is the time you created a GitHub repo but one could create a GitHub repo long after starting work locally.

However this is kind of a nitpick so created_at should be good enough.

@yakov116
Copy link
Member

@fregante

{
  repository(owner: "sindresorhus", name: "refined-github") {
    createdAt
  }
}

=>

{
  "data": {
    "repository": {
      "createdAt": "2016-02-15T16:45:02Z"
    }
  }
}

@maxmclau
Copy link
Contributor

I like the idea of this, I'm going to give adding it a shot. Does anyone have issues with @fregante's idea of adding it to the stats/number's bar?

@maxmclau
Copy link
Contributor

Screen Shot 2019-11-20 at 5 16 48 PM

This is using the repo's created at value, but I'd like to base it off the time of first commit as discussed

@Androz2091
Copy link
Author

Wow, that's awesome. Personally, the date of creation of the repository is perfect for me.

@fregante
Copy link
Member

This is using the repo's created at value, but I'd like to base it off the time of first commit as discussed

As long as it can be determined in one HTTP request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted small Issues that new contributors can pick up
Development

Successfully merging a pull request may close this issue.

6 participants
@sindresorhus @fregante @maxmclau @yakov116 @Androz2091 and others