Forráskód Böngészése

split up delete old commit to always delete them

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 4 éve
szülő
commit
98d1b5e2b9
1 módosított fájl, 6 hozzáadás és 0 törlés
  1. 6 0
      scripts/uploadReport.sh

+ 6 - 0
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#\./##) \;