mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 13:15:35 +03:00
always delete old comments
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
32a0d1c309
commit
3102c23d2c
1 changed files with 10 additions and 7 deletions
|
@ -1,5 +1,14 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
deleteOldComments() {
|
||||||
|
# delete all old comments, matching this 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"|")
|
||||||
|
|
||||||
|
echo $oldComments | while read comment ; do
|
||||||
|
curl 2>/dev/null -u $GITHUB_USER:$GITHUB_PASSWORD -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
upload() {
|
upload() {
|
||||||
cd $1
|
cd $1
|
||||||
|
|
||||||
|
@ -8,13 +17,6 @@ upload() {
|
||||||
|
|
||||||
echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER"
|
echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER"
|
||||||
|
|
||||||
# delete all old comments, matching this 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"|")
|
|
||||||
|
|
||||||
echo $oldComments | while read comment ; do
|
|
||||||
curl 2>/dev/null -u $GITHUB_USER:$GITHUB_PASSWORD -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
|
|
||||||
done
|
|
||||||
|
|
||||||
curl -u $GITHUB_USER:$GITHUB_PASSWORD -X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
|
curl -u $GITHUB_USER:$GITHUB_PASSWORD -X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
|
||||||
-d "{ \"body\" : \"$BRANCH_TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER \" }"
|
-d "{ \"body\" : \"$BRANCH_TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER \" }"
|
||||||
|
|
||||||
|
@ -55,6 +57,7 @@ fi
|
||||||
if [ -e $FOLDER ]; then
|
if [ -e $FOLDER ]; then
|
||||||
upload $FOLDER
|
upload $FOLDER
|
||||||
else
|
else
|
||||||
|
deleteOldComments
|
||||||
echo "$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed."
|
echo "$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed."
|
||||||
|
|
||||||
curl -u $GITHUB_USER:$GITHUB_PASSWORD \
|
curl -u $GITHUB_USER:$GITHUB_PASSWORD \
|
||||||
|
|
Loading…
Reference in a new issue