Rename workflow to PR Slack Notification#2
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WalkthroughThe workflow file is rewritten to rename the workflow to "PR Slack Notification" and to change how comment bodies are processed and posted to Slack. Comment text is cleaned (removing HTML comments and GitHub admonitions, trimming whitespace) and truncation is applied to the cleaned text. Payload construction now branches: if THREAD_TS exists the action posts a thread reply with a quoted clean comment; otherwise it posts a top-level message containing repo/PR context and the quoted clean comment. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/pr-comment-slack-notify.yml (1)
68-82: Consider pagination for high-traffic channels.The thread-finding logic limits history to 200 messages (line 70). In active channels, this may miss earlier PR threads. Consider pagination or increasing the limit if you encounter threading issues.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/pr-comment-slack-notify.yml around lines 68 - 82, The find_thread_ts function currently fetches only the last 200 messages (HISTORY) which can miss older PR threads; update find_thread_ts to paginate through conversations.history using the next_cursor until either you find a message containing PR_URL or there is no more cursor, accumulating/inspecting each page (use SLACK_BOT_TOKEN, SLACK_CHANNEL_ID, PR_URL and THREAD_TS as referenced) and return the latest matching .ts when found; ensure each curl call passes the cursor param and stops early when a match is discovered to avoid fetching unnecessary pages.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/pr-comment-slack-notify.yml:
- Around line 68-82: The find_thread_ts function currently fetches only the last
200 messages (HISTORY) which can miss older PR threads; update find_thread_ts to
paginate through conversations.history using the next_cursor until either you
find a message containing PR_URL or there is no more cursor,
accumulating/inspecting each page (use SLACK_BOT_TOKEN, SLACK_CHANNEL_ID, PR_URL
and THREAD_TS as referenced) and return the latest matching .ts when found;
ensure each curl call passes the cursor param and stops early when a match is
discovered to avoid fetching unnecessary pages.
|
test |
|
@coderabbitai test |
|
Tip For best results, initiate chat on the files or code changes.
|
…and admonitions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Hello |
|
@coderabbitai how verbose are you? |
|
Tip For best results, initiate chat on the files or code changes.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/pr-comment-slack-notify.yml:
- Around line 119-134: The truncation logic currently slices CLEANED_BODY to 200
then appends "..." so TRUNCATED_BODY can be 203 chars; update the truncation to
ensure the final string is at most 200 chars by slicing to 197 before appending
the ellipsis (or alternatively slice to 200 and do not append ellipsis). Modify
the block that sets TRUNCATED_BODY (references CLEANED_BODY and TRUNCATED_BODY)
so the conditional uses ${`#CLEANED_BODY`} -gt 200 and then sets
TRUNCATED_BODY="${CLEANED_BODY:0:197}..." to guarantee a 200-char max, or
implement an equivalent approach (e.g., printf %.200s) that ensures the
ellipsis-inclusive output never exceeds 200 chars.
| # Clean comment body: | ||
| # 1. Remove HTML comments (<!-- ... -->) | ||
| # 2. Remove GitHub admonitions (> [!TIP], > [!NOTE], etc. and their continuation lines) | ||
| # 3. Trim leading/trailing whitespace | ||
| CLEANED_BODY=$(echo "$COMMENT_BODY" | perl -0777 -pe ' | ||
| s/<!--.*?-->//gs; | ||
| s/^>\s*\[!(TIP|NOTE|WARNING|CAUTION|IMPORTANT)\]\s*\n(^>.*\n)*//gm; | ||
| s/^\s+|\s+$//g; | ||
| ') | ||
|
|
||
| # Truncate to 200 chars | ||
| if [ ${#CLEANED_BODY} -gt 200 ]; then | ||
| TRUNCATED_BODY="${CLEANED_BODY:0:200}..." | ||
| else | ||
| TRUNCATED_BODY="$COMMENT_BODY" | ||
| TRUNCATED_BODY="$CLEANED_BODY" | ||
| fi |
There was a problem hiding this comment.
Truncation exceeds the stated 200‑char limit.
The ellipsis makes the output 203 chars. Either adjust the slice or update the comment to match intent.
Suggested fix (cap at 200 including ellipsis)
- # Truncate to 200 chars
- if [ ${`#CLEANED_BODY`} -gt 200 ]; then
- TRUNCATED_BODY="${CLEANED_BODY:0:200}..."
+ # Truncate to 200 chars including ellipsis
+ if [ ${`#CLEANED_BODY`} -gt 200 ]; then
+ TRUNCATED_BODY="${CLEANED_BODY:0:197}..."
else
TRUNCATED_BODY="$CLEANED_BODY"
fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Clean comment body: | |
| # 1. Remove HTML comments (<!-- ... -->) | |
| # 2. Remove GitHub admonitions (> [!TIP], > [!NOTE], etc. and their continuation lines) | |
| # 3. Trim leading/trailing whitespace | |
| CLEANED_BODY=$(echo "$COMMENT_BODY" | perl -0777 -pe ' | |
| s/<!--.*?-->//gs; | |
| s/^>\s*\[!(TIP|NOTE|WARNING|CAUTION|IMPORTANT)\]\s*\n(^>.*\n)*//gm; | |
| s/^\s+|\s+$//g; | |
| ') | |
| # Truncate to 200 chars | |
| if [ ${#CLEANED_BODY} -gt 200 ]; then | |
| TRUNCATED_BODY="${CLEANED_BODY:0:200}..." | |
| else | |
| TRUNCATED_BODY="$COMMENT_BODY" | |
| TRUNCATED_BODY="$CLEANED_BODY" | |
| fi | |
| # Clean comment body: | |
| # 1. Remove HTML comments (<!-- ... -->) | |
| # 2. Remove GitHub admonitions (> [!TIP], > [!NOTE], etc. and their continuation lines) | |
| # 3. Trim leading/trailing whitespace | |
| CLEANED_BODY=$(echo "$COMMENT_BODY" | perl -0777 -pe ' | |
| s/<!--.*?-->//gs; | |
| s/^>\s*\[!(TIP|NOTE|WARNING|CAUTION|IMPORTANT)\]\s*\n(^>.*\n)*//gm; | |
| s/^\s+|\s+$//g; | |
| ') | |
| # Truncate to 200 chars including ellipsis | |
| if [ ${`#CLEANED_BODY`} -gt 200 ]; then | |
| TRUNCATED_BODY="${CLEANED_BODY:0:197}..." | |
| else | |
| TRUNCATED_BODY="$CLEANED_BODY" | |
| fi |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/pr-comment-slack-notify.yml around lines 119 - 134, The
truncation logic currently slices CLEANED_BODY to 200 then appends "..." so
TRUNCATED_BODY can be 203 chars; update the truncation to ensure the final
string is at most 200 chars by slicing to 197 before appending the ellipsis (or
alternatively slice to 200 and do not append ellipsis). Modify the block that
sets TRUNCATED_BODY (references CLEANED_BODY and TRUNCATED_BODY) so the
conditional uses ${`#CLEANED_BODY`} -gt 200 and then sets
TRUNCATED_BODY="${CLEANED_BODY:0:197}..." to guarantee a 200-char max, or
implement an equivalent approach (e.g., printf %.200s) that ensures the
ellipsis-inclusive output never exceeds 200 chars.
Summary
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit