Skip to content

Modular logistics and supply chain operating system (LSOS)

fix discord announcement workflow, attempt 3

Ronald A. Richardson1f609dd88235
diff --git a/.github/workflows/discord-announcement.yml b/.github/workflows/discord-announcement.yml
index 4f65754d..5bc5bfd3 100644
--- a/.github/workflows/discord-announcement.yml
+++ b/.github/workflows/discord-announcement.yml
@@ -16,37 +16,43 @@ jobs:
runs-on: ubuntu-latest
steps:
- # 1️⃣ Resolve which tag we’re talking about
+ # 1️⃣ Figure out which tag we’re talking about
- id: vars
+ shell: bash
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
- echo "tag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
+ TAG="${{ github.event.inputs.tag }}"
else
- echo "tag=${{ github.event.workflow_run.head_branch }}" >> "$GITHUB_OUTPUT"
+ TAG="${{ github.event.workflow_run.head_branch }}"
fi
+ echo "TAG=$TAG" >> "$GITHUB_ENV"
- # 2️⃣ Check out the exact commit that tag points to
+ # 2️⃣ Check out the exact commit for that tag
- uses: actions/checkout@v3
with:
- ref: ${{ steps.vars.outputs.tag }}
- fetch-depth: 1
+ ref: ${{ env.TAG }}
+ fetch-depth: 1 # we only need this one commit
- # 3️⃣ Store RELEASE.md as a *multi-line* output, using heredoc syntax
+ # 3️⃣ Stash RELEASE.md in an env var (one atomic write → no EOF error)
- id: notes
+ shell: bash
run: |
- echo "body<<EOF" >> "$GITHUB_OUTPUT"
- cat RELEASE.md >> "$GITHUB_OUTPUT"
- echo "EOF" >> "$GITHUB_OUTPUT"
-
- # 4️⃣ Post to Discord
+ # Trim to 1900 chars so Discord never rejects the message
+ body=$(<RELEASE.md)
+ [[ ${#body} -gt 1900 ]] && body="${body:0:1900}…"
+ {
+ printf 'RELEASE_BODY<<EOF\n%s\nEOF\n' "$body"
+ } >> "$GITHUB_ENV"
+
+ # 4️⃣ Fire the webhook
- uses: tsickert/[email protected]
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
username: Fleetbase
content: |
@everyone
- 📦 **Fleetbase ${{ steps.vars.outputs.tag }} released!**
+ 📦 **Fleetbase ${{ env.TAG }} released!**
- ${{ steps.notes.outputs.body }}
+ ${{ env.RELEASE_BODY }}
- <https://github.com/${{ github.repository }}/releases/tag/${{ steps.vars.outputs.tag }}>
\ No newline at end of file
+ <https://github.com/${{ github.repository }}/releases/tag/${{ env.TAG }}>
\ No newline at end of file