Skip to content

Commit 2dfaa74

Browse files
committed
fix: deploy
1 parent 924b912 commit 2dfaa74

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010

1111
permissions:
1212
contents: read
13+
actions: write
1314
pages: write
1415
id-token: write
1516

@@ -63,6 +64,28 @@ jobs:
6364
name: github-pages
6465
url: ${{ steps.deployment.outputs.page_url }}
6566
steps:
67+
- name: Deduplicate artifacts
68+
uses: actions/github-script@v7
69+
with:
70+
script: |
71+
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
72+
owner: context.repo.owner,
73+
repo: context.repo.repo,
74+
run_id: context.runId,
75+
});
76+
const pages = artifacts.data.artifacts
77+
.filter(a => a.name === 'github-pages')
78+
.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
79+
for (const dup of pages.slice(1)) {
80+
console.log(`Deleting duplicate artifact ${dup.id} (created ${dup.created_at})`);
81+
await github.rest.actions.deleteArtifact({
82+
owner: context.repo.owner,
83+
repo: context.repo.repo,
84+
artifact_id: dup.id,
85+
});
86+
}
87+
console.log(`Kept artifact ${pages[0].id} (created ${pages[0].created_at})`);
88+
6689
- name: Deploy to GitHub Pages
6790
id: deployment
6891
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)