From 38721424b7efe542faea13d7335cd2752c29edc5 Mon Sep 17 00:00:00 2001 From: "exe.dev user" Date: Wed, 14 Oct 2026 21:09:32 +0000 Subject: [PATCH] fix deploy asset retention for unavailable runs --- .github/workflows/deploy.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9f60ee11..a58a7e2f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -69,14 +69,18 @@ jobs: const artifacts = await github.paginate(github.rest.actions.listArtifactsForRepo, { ...context.repo, per_page: 100 }); for (const artifact of artifacts) { if (artifact.name !== 'factorize-app-assets' || artifact.expired || !artifact.workflow_run) continue; - const { data: run } = await github.rest.actions.getWorkflowRun({ ...context.repo, run_id: artifact.workflow_run.id }); - const jobs = await github.paginate(github.rest.actions.listJobsForWorkflowRun, { ...context.repo, run_id: run.id, per_page: 100 }); - if (!isTrustedAppRelease(artifact, run, jobs, `${context.repo.owner}/${context.repo.repo}`)) continue; - const { data } = await github.rest.actions.downloadArtifact({ ...context.repo, artifact_id: artifact.id, archive_format: 'zip' }); - const archive = `${process.env.RUNNER_TEMP}/factorize-assets-${artifact.id}.zip`; - fs.writeFileSync(archive, Buffer.from(data)); - execFileSync('python3', ['scripts/retain-app-assets.py', archive, 'packages/app/dist'], { stdio: 'inherit' }); - fs.unlinkSync(archive); + try { + const { data: run } = await github.rest.actions.getWorkflowRun({ ...context.repo, run_id: artifact.workflow_run.id }); + const jobs = await github.paginate(github.rest.actions.listJobsForWorkflowRun, { ...context.repo, run_id: run.id, per_page: 100 }); + if (!isTrustedAppRelease(artifact, run, jobs, `${context.repo.owner}/${context.repo.repo}`)) continue; + const { data } = await github.rest.actions.downloadArtifact({ ...context.repo, artifact_id: artifact.id, archive_format: 'zip' }); + const archive = `${process.env.RUNNER_TEMP}/factorize-assets-${artifact.id}.zip`; + fs.writeFileSync(archive, Buffer.from(data)); + execFileSync('python3', ['scripts/retain-app-assets.py', archive, 'packages/app/dist'], { stdio: 'inherit' }); + fs.unlinkSync(archive); + } catch (error) { + core.warning(`Skipping unavailable production asset artifact ${artifact.id}: ${error.message}`); + } } - name: Apply database migrations run: npm run db:migrate --workspace=factorize