Skip to content

Commit 350f32c

Browse files
authored
[ci] Support XODO comments in commit messages (#2998)
(s/X/T/, of course) This allows us to leave general XODOs in commit messages that don't naturally belong in any particular file, and PR merging will be blocked until they are removed. gherrit-pr-id: Gc456c89ea3f26105fca5cadcd11ddc5107ed6afe
1 parent d809e45 commit 350f32c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ci/check_todo.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ rg --version >/dev/null
2424
# -n: Print line number
2525
# -w: Match whole words
2626
# Match TODO, TODO-check-disable, and TODO-check-enable
27-
output=$(rg -H -n -w "$KEYWORD|$KEYWORD-check-disable|$KEYWORD-check-enable" "$@" || true)
27+
PATTERN="$KEYWORD|$KEYWORD-check-disable|$KEYWORD-check-enable"
28+
output=$(rg -H -n -w "$PATTERN" "$@" || true)
29+
30+
commit_output=$(git log -1 --pretty=%B 2>/dev/null | rg -n -w "$PATTERN" || true)
31+
if [ -n "$commit_output" ]; then
32+
commit_output=$(echo "$commit_output" | sed "s/^/COMMIT_MESSAGE:/")
33+
output="$commit_output${output:+$'\n'$output}"
34+
fi
2835

2936
if [ -z "$output" ]; then
3037
exit 0

0 commit comments

Comments
 (0)