Skip to content

fix(repo-stats): split Slack payload body into ≤3000-char section blocks#2172

Open
Copilot wants to merge 3 commits intomainfrom
copilot/fix-slack-post-character-limit
Open

fix(repo-stats): split Slack payload body into ≤3000-char section blocks#2172
Copilot wants to merge 3 commits intomainfrom
copilot/fix-slack-post-character-limit

Conversation

Copy link
Contributor

Copilot AI commented Mar 5, 2026

The weekly repo-stats workflow was failing when posting to Slack because the full report was stuffed into a single section block, which Slack caps at 3000 characters.

Changes

  • awk chunker — splits slack_report.txt line-by-line into numbered temp files (/tmp/sw_chunk_N.txt), flushing a new file whenever the next line would push the current chunk past 3000 chars
  • Dynamic jq payload builder — loops over chunk files to build --rawfile c${i} args and corresponding section-block expressions, then injects them into the Block Kit payload alongside the fixed header/context/divider blocks
  • Guard railNUM_CHUNKS is validated as a positive integer before the loop, defaulting to 1 on unexpected output from awk
# one section block per chunk, all under 3000 chars
SECTION_EXPRS+=("{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\$c${i}}}")

Pure bash solution — awk + jq only, no Python.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits March 5, 2026 18:28
…g awk

Co-authored-by: bojanrajh <117360292+bojanrajh@users.noreply.github.com>
Co-authored-by: bojanrajh <117360292+bojanrajh@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix character limit issue in Slack post fix(repo-stats): split Slack payload body into ≤3000-char section blocks Mar 5, 2026
@bojanrajh Bojan Rajh (bojanrajh) marked this pull request as ready for review March 6, 2026 08:40
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.

2 participants