mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 11:01:54 +00:00
Fix Discord text truncation
This commit is contained in:
parent
0f622417d7
commit
ad0e53aa6f
1 changed files with 15 additions and 21 deletions
36
.github/workflows/release_actions.yml
vendored
36
.github/workflows/release_actions.yml
vendored
|
@ -6,34 +6,28 @@ jobs:
|
||||||
discord_release:
|
discord_release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Get appropriate URL
|
- name: Get release URL
|
||||||
id: get-appropriate-url
|
id: get-release-url
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event.release.prerelease }}" == "true" ]; then
|
if [ "${{ github.event.release.prerelease }}" == "true" ]; then
|
||||||
url="https://zed.dev/releases/preview/latest"
|
URL="https://zed.dev/releases/preview/latest"
|
||||||
else
|
else
|
||||||
url="https://zed.dev/releases/stable/latest"
|
URL="https://zed.dev/releases/stable/latest"
|
||||||
fi
|
fi
|
||||||
echo "::set-output name=url::$url"
|
echo "::set-output name=URL::$URL"
|
||||||
|
- name: Get content
|
||||||
|
uses: 2428392/gh-truncate-string-action@v1.2.0
|
||||||
|
id: get-content
|
||||||
|
with:
|
||||||
|
stringToTruncate: |
|
||||||
|
📣 Zed ${{ github.event.release.tag_name }} was just released!
|
||||||
|
|
||||||
- name: Prepare release content
|
Restart your Zed or head to ${{ steps.get-release-url.outputs.URL }} to grab it.
|
||||||
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"
|
|
||||||
|
|
||||||
|
${{ github.event.release.body }}
|
||||||
|
maxLength: 2000
|
||||||
- name: Discord Webhook Action
|
- name: Discord Webhook Action
|
||||||
uses: tsickert/discord-webhook@v5.3.0
|
uses: tsickert/discord-webhook@v5.3.0
|
||||||
with:
|
with:
|
||||||
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
content: ${{ steps.prepare-content.outputs.content }}
|
content: ${{ steps.get-content.outputs.string }}
|
||||||
|
|
Loading…
Reference in a new issue