Skip to content

Rename workflow to PR Slack Notification#2

Merged
jbingham17 merged 2 commits intomainfrom
test/trigger-thread-notification
Feb 20, 2026
Merged

Rename workflow to PR Slack Notification#2
jbingham17 merged 2 commits intomainfrom
test/trigger-thread-notification

Conversation

@jbingham17
Copy link
Contributor

@jbingham17 jbingham17 commented Feb 20, 2026

Summary

  • Renames the workflow from "PR Comment Slack Notification" to "PR Slack Notification" to reflect that it now handles PR opened events in addition to comments.

Test plan

  • Verify the PR opened event triggers a thread-starting Slack message
  • Comment on this PR to verify comments appear as thread replies

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated workflow for Slack notifications: comment text is now cleaned and trimmed before posting, truncation applies to cleaned text, and messages are sent either as thread replies or top-level posts with richer context depending on thread presence.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

Walkthrough

The 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 @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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.

@jbingham17
Copy link
Contributor Author

test

@jbingham17
Copy link
Contributor Author

@coderabbitai test

@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

Tip

For best results, initiate chat on the files or code changes.

@jbingham17 Hello! I'm here and ready to help. Feel free to ask me to review code, answer questions about the PR, run analysis, or assist with any other tasks.

…and admonitions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jbingham17
Copy link
Contributor Author

Hello

@jbingham17
Copy link
Contributor Author

@coderabbitai how verbose are you?

@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

Tip

For best results, initiate chat on the files or code changes.

@jbingham17 I aim for concise responses with high information density and low fluff. I get to the point quickly, especially when reviewing code or answering technical questions. If you need more detail on something, just ask!

@jbingham17 jbingham17 merged commit fb0ea19 into main Feb 20, 2026
1 check was pending
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +119 to 134
# 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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
# 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant