Skip to content

Commit ff7b9b7

Browse files
Merge pull request #251 from GenerationSoftware/fix/deploy-skip-unavailable-assets
Fix deploy asset retention when historical runs are unavailable
2 parents 8fa3bb0 + 3872142 commit ff7b9b7

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

‎.github/workflows/deploy.yml‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,18 @@ jobs:
6969
const artifacts = await github.paginate(github.rest.actions.listArtifactsForRepo, { ...context.repo, per_page: 100 });
7070
for (const artifact of artifacts) {
7171
if (artifact.name !== 'factorize-app-assets' || artifact.expired || !artifact.workflow_run) continue;
72-
const { data: run } = await github.rest.actions.getWorkflowRun({ ...context.repo, run_id: artifact.workflow_run.id });
73-
const jobs = await github.paginate(github.rest.actions.listJobsForWorkflowRun, { ...context.repo, run_id: run.id, per_page: 100 });
74-
if (!isTrustedAppRelease(artifact, run, jobs, `${context.repo.owner}/${context.repo.repo}`)) continue;
75-
const { data } = await github.rest.actions.downloadArtifact({ ...context.repo, artifact_id: artifact.id, archive_format: 'zip' });
76-
const archive = `${process.env.RUNNER_TEMP}/factorize-assets-${artifact.id}.zip`;
77-
fs.writeFileSync(archive, Buffer.from(data));
78-
execFileSync('python3', ['scripts/retain-app-assets.py', archive, 'packages/app/dist'], { stdio: 'inherit' });
79-
fs.unlinkSync(archive);
72+
try {
73+
const { data: run } = await github.rest.actions.getWorkflowRun({ ...context.repo, run_id: artifact.workflow_run.id });
74+
const jobs = await github.paginate(github.rest.actions.listJobsForWorkflowRun, { ...context.repo, run_id: run.id, per_page: 100 });
75+
if (!isTrustedAppRelease(artifact, run, jobs, `${context.repo.owner}/${context.repo.repo}`)) continue;
76+
const { data } = await github.rest.actions.downloadArtifact({ ...context.repo, artifact_id: artifact.id, archive_format: 'zip' });
77+
const archive = `${process.env.RUNNER_TEMP}/factorize-assets-${artifact.id}.zip`;
78+
fs.writeFileSync(archive, Buffer.from(data));
79+
execFileSync('python3', ['scripts/retain-app-assets.py', archive, 'packages/app/dist'], { stdio: 'inherit' });
80+
fs.unlinkSync(archive);
81+
} catch (error) {
82+
core.warning(`Skipping unavailable production asset artifact ${artifact.id}: ${error.message}`);
83+
}
8084
}
8185
- name: Apply database migrations
8286
run: npm run db:migrate --workspace=factorize

0 commit comments

Comments
 (0)