Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 02:00 UTC
fix(ci): escape multiline Slack release payload
jkomyno committed
Mar 20, 2026 at 19:20 UTC
4d74c104e0f3671a2a3b36d608b28632bf3228fb
1 file changed
+20
-11
.github/workflows/ts.release.yml
+20
-11
@@ -48,8 +48,8 @@ jobs:
48
env:
49
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
50
run: |
51
- echo "SLACK_VERSIONS<<EOF" >> $GITHUB_ENV
52
- echo "$PUBLISHED_PACKAGES" | jq -c '.[]' | while read -r pkg; do
51
+ SLACK_VERSIONS=""
52
+ while read -r pkg; do
53
NAME=$(echo "$pkg" | jq -r '.name')
54
NEW_VERSION=$(echo "$pkg" | jq -r '.version')
55
PKG_PATH=$(pnpm list --filter "$NAME" --json | jq -r '.[0].path')
@@ -57,23 +57,32 @@ jobs:
57
REL_PKG_JSON_PATH="${PKG_PATH#$GITHUB_WORKSPACE/}/package.json"
58
OLD_VERSION=$(git show "HEAD^:$REL_PKG_JSON_PATH" | jq -r .version 2>/dev/null || echo "")
59
if [ -n "$OLD_VERSION" ] && [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
60
- echo "⚡️ $NAME: \`$OLD_VERSION\` -> \`$NEW_VERSION\`" >> $GITHUB_ENV
60
+ VERSION_LINE="⚡️ $NAME: \`$OLD_VERSION\` -> \`$NEW_VERSION\`"
61
else
62
- echo "⚡️ $NAME: \`$NEW_VERSION\`" >> $GITHUB_ENV
62
+ VERSION_LINE="⚡️ $NAME: \`$NEW_VERSION\`"
63
fi
64
else
65
- echo "⚡️ $NAME: \`$NEW_VERSION\`" >> $GITHUB_ENV
65
+ VERSION_LINE="⚡️ $NAME: \`$NEW_VERSION\`"
66
fi
67
- done
68
- echo "EOF" >> $GITHUB_ENV
67
+ if [ -n "$SLACK_VERSIONS" ]; then
68
+ SLACK_VERSIONS="$SLACK_VERSIONS
69
+$VERSION_LINE"
70
+ else
71
+ SLACK_VERSIONS="$VERSION_LINE"
72
+ fi
73
+ done < <(jq -c '.[]' <<<"$PUBLISHED_PACKAGES")
74
+ # Build a single-line JSON payload so multiline version info is safely escaped.
75
+ SLACK_PAYLOAD=$(jq -nc \
76
+ --arg repository "$GITHUB_REPOSITORY" \
77
+ --arg versions "$SLACK_VERSIONS" \
78
+ --arg sha "$GITHUB_SHA" \
79
+ '{text: "🚀 New SDK version published!\n*Repository:* \($repository)\n*Versions:*\n\($versions)\n*Commit:* \($sha)"}')
80
+ echo "SLACK_PAYLOAD=$SLACK_PAYLOAD" >> "$GITHUB_ENV"
81
82
- name: Send Slack Notification
83
if: steps.changesets.outputs.published == 'true'
84
uses: slackapi/slack-github-action@fcfb566f8b0aab22203f066d80ca1d7e4b5d05b3 # v1.27.1
85
with:
74
- payload: |
75
- {
76
- "text": "🚀 New SDK version published!\n*Repository:* ${{ github.repository }}\n*Versions:*\n${{ env.SLACK_VERSIONS }}\n*Commit:* ${{ github.sha }}"
77
- }
86
+ payload: ${{ env.SLACK_PAYLOAD }}
87
env:
88
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_RELEASE_WEBHOOK_URL }}