Skip to content

Instantly share code, notes, and snippets.

@nickboldt
Last active March 28, 2025 16:48
Show Gist options
  • Save nickboldt/f79e251794a80c4e82910743b826f96b to your computer and use it in GitHub Desktop.
Save nickboldt/f79e251794a80c4e82910743b826f96b to your computer and use it in GitHub Desktop.
delete GL MR comments (notes)
# for a given merge_request, delete its comments (notes):
# this will make reading the information in a MR much easier
# as you won't have dozens of Kfux comments to scroll past and ignore
GL_API_TOKEN="your token here"
PROJECT="rhidp%2Frhdh" # or "rhidp%2Frhdh-plugin-catalog"
MR=197
for page in 1 2 3 4; do
for id in $(curl --request GET --header "PRIVATE-TOKEN: $GL_API_TOKEN" \
--url "https://gitlab.cee.redhat.com/api/v4/projects/${PROJECT}/merge_requests/${MR}/notes?sort=desc&page=$page" \
-sS | jq -r '.[].id'); do
echo -n "> $id "
curl --request DELETE --header "PRIVATE-TOKEN: $GL_API_TOKEN" \
--url "https://gitlab.cee.redhat.com/api/v4/projects/${PROJECT}/merge_requests/${MR}/notes/${id}"; echo
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment