Skip to content

Commit a664df9

Browse files
.github/workflows/release:
1 parent 4e8426f commit a664df9

1 file changed

Lines changed: 29 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,33 @@ jobs:
116116
dist/SHA256SUMS.txt
117117
118118
- name: Purge workflow artifacts
119-
uses: kolpav/purge-artifacts-action@v2
119+
uses: actions/github-script@v7
120120
with:
121-
token: ${{ github.token }}
122-
max-entries: 0
121+
script: |
122+
const { owner, repo } = context.repo;
123+
let page = 1;
124+
let deleted = 0;
125+
for (;;) {
126+
const { data } = await github.rest.actions.listArtifactsForRepo({
127+
owner,
128+
repo,
129+
per_page: 100,
130+
page,
131+
});
132+
if (data.artifacts.length === 0) {
133+
break;
134+
}
135+
for (const artifact of data.artifacts) {
136+
await github.rest.actions.deleteArtifact({
137+
owner,
138+
repo,
139+
artifact_id: artifact.id,
140+
});
141+
deleted += 1;
142+
}
143+
if (data.artifacts.length < 100) {
144+
break;
145+
}
146+
page += 1;
147+
}
148+
core.info(`Deleted ${deleted} workflow artifact(s).`);

0 commit comments

Comments
 (0)