Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ fi

REASON="Reading or writing MR discussions/notes via \`glab\` is blocked (matched: \`glab api .../discussions|notes\`, \`glab mr view --comments\`, or \`glab mr note\`). Use the \`glab-discussion\` CLI instead: \`glab-discussion read|write|diff|resolve|edit|delete\`. Run \`glab-discussion --help\` for usage, or load the \`glab-discussion\` skill."

if printf '%s' "$CMD" | grep -qE 'glab[[:space:]]+api\b.*merge_requests[^"'"'"']*/(discussions|notes)' \
# Award emoji (reactions) live under the notes URL path but are not discussion
# CRUD, and glab-discussion has no replacement command — let them through.
if { printf '%s' "$CMD" | grep -qE 'glab[[:space:]]+api\b.*merge_requests[^"'"'"']*/(discussions|notes)' \
&& ! printf '%s' "$CMD" | grep -qE 'glab[[:space:]]+api\b.*merge_requests[^"'"'"']*/award_emoji\b'; } \
|| printf '%s' "$CMD" | grep -qE 'glab[[:space:]]+mr[[:space:]]+view\b.*--comments\b' \
|| printf '%s' "$CMD" | grep -qE 'glab[[:space:]]+mr[[:space:]]+note\b'; then
jq -n --arg reason "$REASON" '{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ run_case ALLOW 'glab mr create'
run_case ALLOW 'glab mr approve 42'
run_case ALLOW 'glab mr todo 42'

# ---------------- ALLOW: award emoji (reactions) under notes ----------------
run_case ALLOW 'glab api projects/123/merge_requests/5/notes/99/award_emoji -X POST -f name=recycle'
run_case ALLOW 'glab api "projects/:id/merge_requests/20/notes/1996757/award_emoji" -f name=thumbsup'
run_case ALLOW 'glab api projects/123/merge_requests/5/notes/99/award_emoji/7 -X DELETE'
run_case ALLOW 'glab api projects/mygroup%2Fmyrepo/merge_requests/42/award_emoji'

# ---------------- ALLOW: unrelated glab api calls ----------------
run_case ALLOW 'glab api projects/mygroup%2Fmyrepo/merge_requests/42'
run_case ALLOW 'glab api "projects/mygroup%2Fmyrepo"'
Expand Down