Skip to content

Commit

Permalink
Merge pull request #31 from saadbruno/latest-release-date
Browse files Browse the repository at this point in the history
we now consider the date of the last release on github
  • Loading branch information
saadbruno authored Sep 12, 2022
2 parents 770ca59 + bb2165b commit 7d460f1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions code/lib/db/submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ function savePlugin($githubUrl)
avatarUrl
url
}
latestRelease {
publishedAt
}
readme1: object(expression: "master:readme.md") {
... on Blob {
text
Expand Down Expand Up @@ -125,8 +128,14 @@ function savePlugin($githubUrl)
return json_encode($result);
}

// converts the timestamp
$updatedAt = date("U", strtotime($result['data']['repository']['updatedAt']));
// Let's get the latest update timestamp for the repo.
// If the repo has a release on GitHub, we use the release date. Otherwise we get the time of the latest commit
if (isset($result['data']['repository']['latestRelease']['publishedAt'])) {
$updatedAt = date("U", strtotime($result['data']['repository']['latestRelease']['publishedAt']));
} else {
$updatedAt = date("U", strtotime($result['data']['repository']['pushedAt']));
}

$submittedAt = time();

// converts OG image to boolean
Expand Down

0 comments on commit 7d460f1

Please sign in to comment.