master
sh 32 lines 973 Bytes
Raw
1 #!/usr/bin/env bash
2 # Re-trigger cubic-dev-ai to re-review the PR.
3 #
4 # Cubic does not react to comments inside threads. It re-reviews when a NEW
5 # top-level PR comment mentions it. Posting the comment is the trigger.
6 #
7 # Usage:
8 # trigger-cubic.sh <pr-number> [<extra-message>]
9 #
10 # Default body is "@cubic-dev-ai please review again". Override by passing a
11 # second argument; the @cubic-dev-ai mention is always prepended so the bot
12 # is guaranteed to see it.
13
14 set -euo pipefail
15
16 # shellcheck source=./_lib.sh
17 # shellcheck disable=SC1091
18 source "$(dirname "$0")/_lib.sh"
19 pr_require_gh
20
21 PR="${1:?usage: $0 <pr-number> [<extra-message>]}"
22 pr_require_numeric "${PR}"
23 EXTRA="${2:-please review again}"
24
25 SLUG="$(pr_require_slug)"
26 BODY="@cubic-dev-ai ${EXTRA}"
27
28 echo -e "${PR_GRAY}[trigger-cubic] PR ${SLUG}#${PR}: ${BODY}${PR_NC}" >&2
29
30 gh api --method POST "/repos/${SLUG}/issues/${PR}/comments" \
31 -f body="${BODY}" \
32 --jq '"posted comment id=\(.id) url=\(.html_url)"'