From 98d1b5e2b9728a01a3b4294ba6600e46b4df9c51 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Jun 2020 12:42:11 +0200 Subject: [PATCH] split up delete old commit to always delete them Signed-off-by: tobiasKaminsky --- scripts/uploadReport.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/uploadReport.sh b/scripts/uploadReport.sh index 933285d232..e4686f706b 100755 --- a/scripts/uploadReport.sh +++ b/scripts/uploadReport.sh @@ -2,14 +2,20 @@ deleteOldComments() { # delete all old comments, matching this type + echo "Deleting old comments for $BRANCH_TYPE" oldComments=$(curl 2>/dev/null -u $GITHUB_USER:$GITHUB_PASSWORD -X GET https://api.github.com/repos/nextcloud/android/issues/$PR/comments | jq --arg TYPE $BRANCH_TYPE '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) + "|" + (.body | test([$TYPE]) | tostring)'| grep "true|true" | tr -d "\"" | cut -f1 -d"|") + count=$(echo $oldComments | grep true | wc -l) + echo "Found $count old comments" echo $oldComments | while read comment ; do + echo "Deleting comment: $comment" curl 2>/dev/null -u $GITHUB_USER:$GITHUB_PASSWORD -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment done } upload() { + deleteOldComments + cd $1 find . -type d -exec curl -u $USER:$PASS -X MKCOL $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) \;