Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Truncate Discord release note text

Joseph T. Lyonsdcdd74dff43b
diff --git a/.github/workflows/release_actions.yml b/.github/workflows/release_actions.yml
index f767324e4f6..54e5d07787f 100644
--- a/.github/workflows/release_actions.yml
+++ b/.github/workflows/release_actions.yml
@@ -10,19 +10,30 @@ jobs:
id: get-appropriate-url
run: |
if [ "${{ github.event.release.prerelease }}" == "true" ]; then
- URL="https://zed.dev/releases/preview/latest"
+ url="https://zed.dev/releases/preview/latest"
else
- URL="https://zed.dev/releases/stable/latest"
+ url="https://zed.dev/releases/stable/latest"
fi
- echo "::set-output name=URL::$URL"
+ echo "::set-output name=url::$url"
+
+ - name: Prepare release content
+ id: prepare-content
+ run: |
+ set -eu
+
+ text="📣 Zed ${{ github.event.release.tag_name }} was just released!\n\nRestart your Zed or head to ${{ steps.get-appropriate-url.outputs.URL }} to grab it.\n\n${{ github.event.release.body }}"
+
+ maxTextLength=2000
+ truncationIndicator="..."
+
+ if (( ${#text} > maxTextLength )); then
+ text=${text:0:maxTextLength - ${#truncationIndicator}}$truncationIndicator
+ fi
+
+ echo "::set-output name=content::$text"
- name: Discord Webhook Action
uses: tsickert/[email protected]
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
- content: |
- 📣 Zed ${{ github.event.release.tag_name }} was just released!
-
- Restart your Zed or head to ${{ steps.get-appropriate-url.outputs.URL }} to grab it.
-
- ${{ github.event.release.body }}
+ content: ${{ steps.prepare-content.outputs.content }}