diff --git a/.buildkite/scripts/steps/cloud/purge_deployments.ts b/.buildkite/scripts/steps/cloud/purge_deployments.ts index a166f09b73d6a..845e6740cd48e 100644 --- a/.buildkite/scripts/steps/cloud/purge_deployments.ts +++ b/.buildkite/scripts/steps/cloud/purge_deployments.ts @@ -23,12 +23,11 @@ const DAY_IN_SECONDS = 60 * 60 * 24; for (const deployment of prDeployments) { try { const prNumber = deployment.name.match(/^kibana-pr-([0-9]+)$/)[1]; - const prJson = execSync(`gh pr view '${prNumber}' --json state,labels,commits`).toString(); + const prJson = execSync(`gh pr view '${prNumber}' --json state,labels,updatedAt`).toString(); const pullRequest = JSON.parse(prJson); const prOpen = pullRequest.state === 'OPEN'; - const lastCommit = pullRequest.commits.slice(-1)[0]; - const lastCommitTimestamp = new Date(lastCommit.committedDate).getTime() / 1000; + const lastCommitTimestamp = new Date(pullRequest.updatedAt).getTime() / 1000; const persistDeployment = Boolean( pullRequest.labels.filter((label: any) => label.name === 'ci:cloud-persist-deployment').length diff --git a/.buildkite/scripts/steps/cloud/purge_projects.ts b/.buildkite/scripts/steps/cloud/purge_projects.ts index f89aa65fa855a..c3c427c6a3885 100644 --- a/.buildkite/scripts/steps/cloud/purge_projects.ts +++ b/.buildkite/scripts/steps/cloud/purge_projects.ts @@ -66,12 +66,11 @@ async function purgeProjects() { const NOW = new Date().getTime() / 1000; const DAY_IN_SECONDS = 60 * 60 * 24; const prJson = execSync( - `gh pr view '${project.prNumber}' --json state,labels,commits` + `gh pr view '${project.prNumber}' --json state,labels,updatedAt` ).toString(); const pullRequest = JSON.parse(prJson); const prOpen = pullRequest.state === 'OPEN'; - const lastCommit = pullRequest.commits.slice(-1)[0]; - const lastCommitTimestamp = new Date(lastCommit.committedDate).getTime() / 1000; + const lastCommitTimestamp = new Date(pullRequest.updatedAt).getTime() / 1000; const persistDeployment = Boolean( pullRequest.labels.filter((label: any) => label.name === 'ci:project-persist-deployment')