-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated workflows and created shell script to delete all artifacts fr…
…om the repo
- Loading branch information
1 parent
e4e3038
commit f870c58
Showing
5 changed files
with
40 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
# | ||
# !! CAUTION WHEN YOU USE THIS SCRIPT !! | ||
# This script deletes all artifacts from the repo using Github CLI. | ||
# This will NOT break the deployment of ACCESS-Hive (https://access-hive.org.au/) | ||
|
||
set -eu | ||
|
||
invoke_api() { | ||
gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "$@" | ||
} | ||
|
||
list_artifacts() { | ||
invoke_api https://api.github.com/repos/ACCESS-Hive/access-hive.github.io/actions/artifacts | ||
} | ||
|
||
list=$(list_artifacts | jq '.artifacts | .[] | .url') | ||
tot=$(list_artifacts | jq '.total_count') | ||
|
||
delete_artifact() { | ||
invoke_api -X DELETE "$1" | ||
echo "Deleted artifact $2/$tot: $1" 1>&2 | ||
} | ||
|
||
i=1 | ||
while true; do | ||
if [ "$i" -lt "$tot" ]; then | ||
for l in ${list} ; do | ||
artifact=$(echo $l | tr -d '"') | ||
delete_artifact "$artifact" $i $tot | ||
i=$((i+1)) | ||
done | ||
list=$(list_artifacts | jq '.artifacts | .[] | .url') | ||
else | ||
echo "Done!" | ||
exit 0 | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters