Skip to content

Commit e6009c5

Browse files
committed
FIX: Use updated_at instead of pushed_at
pushed_at doesn't necessarily trigger a change to the repo
1 parent bc2305f commit e6009c5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

helpers/octokit.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ const graphQLAuth = graphql.defaults({
4545
})
4646

4747
/**
48-
* Gets Repo created_at, pushed_at and latest commit SHA, as well as rate limit info
48+
* Gets Repo created_at, updated_at and latest commit SHA, as well as rate limit info
4949
*
5050
* Note that this GraphQL query is essentially FREE in terms of rate limiting as it is only 1 point cost, which won't
5151
* actually count against the GraphQL rate limit.
5252
*
5353
* This contrasts with the REST API which would require 2 requests to get the same information:
54-
* 1. Get the repo-level info like created_at and pushed_at
54+
* 1. Get the repo-level info like created_at and updated_at
5555
* 2. Get the latest commit SHA
5656
*
5757
* In testing, this query sped up the build script from 80 minutes to 60 minutes.
@@ -63,7 +63,7 @@ const graphQLAuth = graphql.defaults({
6363
* {
6464
* repository: {
6565
* createdAt: '2022-01-01T00:00:00Z',
66-
* pushedAt: '2023-01-01T00:00:00Z',
66+
* updatedAt: '2023-01-01T00:00:00Z',
6767
* defaultBranchRef: {
6868
* target: {
6969
* oid: 'sha-123'
@@ -86,7 +86,7 @@ export async function getRepoInfo (owner, name) {
8686
query($owner: String!, $name: String!) {
8787
repository(owner: $owner, name: $name) {
8888
createdAt
89-
pushedAt
89+
updatedAt
9090
defaultBranchRef {
9191
target {
9292
... on Commit {

helpers/repo-data.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ export class RepoData {
7575
const response = await getRepoInfo(this.repoOwner, this.repoName)
7676

7777
this.repoCreated = response.repository?.createdAt
78-
this.lastUpdated = response.repository?.pushedAt
78+
this.lastUpdated = response.repository?.updatedAt
7979
this.latestCommitSHA = response.repository?.defaultBranchRef?.target?.oid
8080
this.graphQLRateLimit = response.rateLimit
8181

82-
// Some repos won't have a pushed_at
82+
// Some repos won't have a updated_at
8383
if (!this.repoCreated) {
8484
throw new NoMetaDataError()
8585
}

0 commit comments

Comments
 (0)