mirror of
https://github.com/openstreetmap/id-tagging-schema.git
synced 2025-10-26 20:33:51 +01:00
clean up artifacts after deployment
This commit is contained in:
parent
e8e6c787e6
commit
090d5f5555
1 changed files with 23 additions and 1 deletions
24
.github/workflows/deploy-preview.yml
vendored
24
.github/workflows/deploy-preview.yml
vendored
|
|
@ -33,7 +33,7 @@ jobs:
|
|||
artifact => artifact.name === 'pr'
|
||||
)[0];
|
||||
if (!artifact) {
|
||||
throw new Error('No pr artifact found');
|
||||
throw new Error('No "pr" artifact found');
|
||||
}
|
||||
const download = await github.rest.actions.downloadArtifact({
|
||||
owner: context.repo.owner,
|
||||
|
|
@ -83,3 +83,25 @@ jobs:
|
|||
} else {
|
||||
console.log(`Preview URL comment already added to PR #${pullRequestNumber}`);
|
||||
}
|
||||
|
||||
- name: Clean up artifact
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: ${{github.event.workflow_run.id}}
|
||||
});
|
||||
const artifact = artifacts.data.artifacts.filter(
|
||||
artifact => artifact.name === 'preview'
|
||||
)[0];
|
||||
if (!artifact) {
|
||||
throw new Error('No "preview" artifact found');
|
||||
}
|
||||
await github.rest.actions.deleteArtifact({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
artifact_id: artifact.id
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue