Skip to content

Commit 11c43e4

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 11c43e4

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
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
}

helpers/repo-data.test.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('RepoData', () => {
6262
data: {
6363
repository: {
6464
createdAt: '2022-01-01T00:00:00Z',
65-
pushedAt: '2023-01-01T00:00:00Z'
65+
updatedAt: '2023-01-01T00:00:00Z'
6666
}
6767
}
6868
})
@@ -77,7 +77,7 @@ describe('RepoData', () => {
7777
getRepoInfo.mockResolvedValue({
7878
repository: {
7979
createdAt: '2022-01-01T00:00:00Z',
80-
pushedAt: '2023-01-01T00:00:00Z'
80+
updatedAt: '2023-01-01T00:00:00Z'
8181
}
8282
})
8383

@@ -91,7 +91,7 @@ describe('RepoData', () => {
9191
getRepoInfo.mockResolvedValue({
9292
repository: {
9393
createdAt: '2022-01-01T00:00:00Z',
94-
pushedAt: '2023-01-01T00:00:00Z',
94+
updatedAt: '2023-01-01T00:00:00Z',
9595
defaultBranchRef: {
9696
target: {
9797
oid: 'test-sha'

0 commit comments

Comments
 (0)