Skip to content

Commit d634baf

Browse files
committed
Merge branch 'fix/work_flow' into 'master'
fix(workflow): Fix delete-old-artifacts failed See merge request ae_group/esp-box!125
2 parents 21f18d4 + c4eb278 commit d634baf

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

.github/workflows/build-examples-gh-pages-on-push.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,32 @@ jobs:
3737
delete-old-artifacts:
3838
runs-on: ubuntu-latest
3939
steps:
40-
- name: Delete old artifacts
41-
uses: geekyeggo/delete-artifact@v2
40+
- name: List and Delete artifacts
41+
uses: actions/github-script@v7
4242
with:
43-
name: build-images-* # Delete all artifacts with name starting with build-images-
43+
script: |
44+
const artifacts = await github.rest.actions.listArtifactsForRepo({
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
});
48+
49+
console.log('Found artifacts:', artifacts.data.artifacts.map(a => a.name));
50+
51+
for (const artifact of artifacts.data.artifacts) {
52+
if (artifact.name.startsWith('build-images-')) {
53+
console.log(`Deleting artifact: ${artifact.name}`);
54+
try {
55+
await github.rest.actions.deleteArtifact({
56+
owner: context.repo.owner,
57+
repo: context.repo.repo,
58+
artifact_id: artifact.id,
59+
});
60+
console.log(`Successfully deleted: ${artifact.name}`);
61+
} catch (error) {
62+
console.log(`Failed to delete ${artifact.name}:`, error.message);
63+
}
64+
}
65+
}
4466
4567
job1:
4668
needs: [delete-old-artifacts]

0 commit comments

Comments
 (0)