Skip to content

Commit 8e1336f

Browse files
refactor(gh-scripts - clear_cache): change curl headers to this default by github api documentation
1 parent 07ebd93 commit 8e1336f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

gh-scripts/clear-cache.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ local GH_REPO=$3
88

99
while :; do
1010
JSON_OUTPUT=$(curl \
11-
-H "Accept: application/vnd.github.v3+json" \
12-
-H "Authorization: token $GH_TOKEN" \
11+
-H "Accept: application/vnd.github+json" \
12+
-H "Authorization: Bearer $GH_TOKEN" \
13+
-H "X-GitHub-Api-Version: 2022-11-28" \
1314
https://api.github.com/repos/$GH_ONWER/$GH_REPO/actions/caches)
1415

1516
GH_CACHE_IDS=$(echo "$JSON_OUTPUT" | jq '.actions_caches[] | {id: .id}' | grep "id" | cut -d ':' -f 2 | cut -c 2-)
@@ -22,10 +23,11 @@ while :; do
2223

2324
for GH_CACHE_ID in $GH_CACHE_IDS; do
2425
echo "Delete Cache-ID: $GH_CACHE_ID"
25-
curl \
26+
curl -L \
2627
-X DELETE \
27-
-H "Accept: application/vnd.github.v3+json" \
28-
-H "Authorization: token $GH_TOKEN" \
28+
-H "Accept: application/vnd.github+json" \
29+
-H "Authorization: Bearer $GH_TOKEN" \
30+
-H "X-GitHub-Api-Version: 2022-11-28" \
2931
https://api.github.com/repos/$GH_ONWER/$GH_REPO/actions/caches/$GH_CACHE_ID
3032
done
3133

0 commit comments

Comments
 (0)