Skip to content

Commit

Permalink
💩 Do not download expired artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
polRk committed Oct 28, 2024
1 parent 5a5caa4 commit 0a26b30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions init/post.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions init/src/jobs/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import type { Series } from '../report/chart'
info(`Metrics written to ${metricsPath}`)

info("Upload metrics as an artifact...")
let { id } = await artifactClient.uploadArtifact(`${sdk}-metrics.json`, [metricsPath], cwd, { retentionDays: 1 })
let { id } = await artifactClient.uploadArtifact(`${sdk}-metrics.json`, [metricsPath], cwd, { retentionDays: isPullRequest ? 1 : 30 })
info(`Metrics uploaded as an artifact ${id}`)
}

Expand All @@ -59,7 +59,7 @@ import type { Series } from '../report/chart'

info(`Fetching information about previous runs for base branch...`)
let runs = await getCurrentWorkflowRuns(pr.base.ref)
info(`Found ${runs.length} completed and successfull runs for default branch.`)
info(`Found ${runs.length} completed and successful runs for default branch.`)
debug(`Previous runs for base branch: ${JSON.stringify(runs.map(run => ({ id: run.id, upd: run.updated_at })), null, 4)}`)

if (runs.length === 0) {
Expand All @@ -82,8 +82,8 @@ import type { Series } from '../report/chart'
debug(`Latest run artifacts: ${JSON.stringify(artifacts, null, 4)}`)

let artifact = artifacts.find(artifact => artifact.name === `${sdk}-metrics.json`)
if (!artifact) {
warning("Metrics for base ref not found.")
if (!artifact || artifact.expired) {
warning("Metrics for base ref not found or expired.")
} else {
debug(`Metrics artifact: ${JSON.stringify(artifact, null, 4)}`)

Expand Down

0 comments on commit 0a26b30

Please sign in to comment.