Skip to content

Commit cf83183

Browse files
committed
Ignore private changes and comments
Do not process events from changes which are either private or belong to branches where anonymous user doesn't have access (e.g. refs/meta/config branches). If it's not readable by anonymous user - don't run it. Signed-off-by: Karol Latecki <[email protected]>
1 parent ddc719e commit cf83183

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

.github/workflows/gerrit-false-positives-handler.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,16 @@ jobs:
6060
fi
6161
6262
# Get latest info about a change itself
63-
curl -s -X GET "https://review.spdk.io/a/changes/spdk%2Fspdk~${{ env.change_num }}?o=DETAILED_ACCOUNTS&o=MESSAGES&o=LABELS&o=SKIP_DIFFSTAT" \
64-
--user "${{ secrets.GERRIT_BOT_USER }}:${{ secrets.GERRIT_BOT_HTTP_PASSWD }}" \
65-
| tail -n +2 > change.json
63+
curl -s -X GET "https://review.spdk.io/changes/spdk%2Fspdk~${{ env.change_num }}?o=DETAILED_ACCOUNTS&o=LABELS&o=SKIP_DIFFSTAT" > curl_result.txt
64+
65+
if grep "Not found" curl_result.txt; then
66+
echo "Ignore. Change ${{ env.change_num }} not found, exiting."
67+
echo "Either it's a private change or in restricted branch."
68+
exit 0
69+
fi
70+
71+
tail -n +2 curl_result.txt > change.json
72+
rm -f curl_result.txt
6673
6774
# Do not test any change marked as WIP
6875
ready_for_review="$(jq -r '.has_review_started' change.json)"

.github/workflows/gerrit-webhook-handler.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,16 @@ jobs:
4545
set -x
4646
4747
# Get latest info about a change itself
48-
curl -s -X GET "https://review.spdk.io/a/changes/spdk%2Fspdk~${{ env.change_num }}?o=DETAILED_ACCOUNTS&o=LABELS&o=SKIP_DIFFSTAT" \
49-
--user "${{ secrets.GERRIT_BOT_USER }}:${{ secrets.GERRIT_BOT_HTTP_PASSWD }}" \
50-
| tail -n +2 > change.json
48+
curl -s -X GET "https://review.spdk.io/changes/spdk%2Fspdk~${{ env.change_num }}?o=DETAILED_ACCOUNTS&o=LABELS&o=SKIP_DIFFSTAT" > curl_result.txt
49+
50+
if grep "Not found" curl_result.txt; then
51+
echo "Change ${{ env.change_num }} not found, exiting."
52+
echo "Either it's a private change or in restricted branch."
53+
gh run cancel ${{ github.run_id }} -R ${{ github.repository }}
54+
fi
55+
56+
tail -n +2 curl_result.txt > change.json
57+
rm -f curl_result.txt
5158
5259
# Do not test any change marked as WIP
5360
ready_for_review="$(jq -r '.has_review_started' change.json)"

0 commit comments

Comments
 (0)