File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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).`);
You can’t perform that action at this time.
0 commit comments