Skip to content

Commit 3626bb5

Browse files
committed
Add cleanup script to use when closing PR
1 parent 6aaa903 commit 3626bb5

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

cleanup.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
BRANCH="documentation-preview"
6+
ARTIFACTS=$(
7+
gh api \
8+
--paginate \
9+
-H "Accept: application/vnd.github+json" \
10+
-H "X-GitHub-Api-Version: 2022-11-28" \
11+
/repos/probabl-ai/skore/actions/artifacts \
12+
|
13+
jq -c ".artifacts[] | select(.workflow_run.head_branch == \"${BRANCH}\") | {id: .id, name: .name}"
14+
)
15+
16+
for ARTIFACT in $ARTIFACTS; do
17+
ID=$(echo "${ARTIFACT}" | jq -r '.id')
18+
NAME=$(echo "${ARTIFACT}" | jq -r '.name')
19+
20+
echo "Deleting artifact (BRANCH: \"${BRANCH}\", NAME: \"${NAME}\", ID: \"${ID}\")"
21+
22+
gh api \
23+
--method DELETE \
24+
--silent \
25+
-H "Accept: application/vnd.github+json" \
26+
-H "X-GitHub-Api-Version: 2022-11-28" \
27+
/repos/probabl-ai/skore/actions/artifacts/${ID}
28+
done

0 commit comments

Comments
 (0)