Skip to content

Commit 5837e13

Browse files
Refactor release variables for safety and clarity
1 parent 800135d commit 5837e13

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/community-release-notifier.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,19 @@ jobs:
3939
steps:
4040
- name: Prepare release variables
4141
id: vars
42+
env:
43+
INPUT_TAG: ${{ github.event.release.tag_name || inputs.tag_name }}
44+
INPUT_URL: ${{ github.event.release.url || inputs.url }}
45+
INPUT_BODY: ${{ github.event.release.body || inputs.body }}
4246
run: |
43-
TAG="${{ github.event.release.tag_name || inputs.tag_name }}"
44-
URL="${{ github.event.release.url || inputs.url }}"
47+
TAG="$INPUT_TAG"
48+
URL="$INPUT_URL"
4549
# Escape problematic characters for MarkdownV2 (very conservative escaping)
4650
# We escape: _ * [ ] ( ) ~ ` > # + - = | { } . ! \
47-
BODY_SAFE=$(printf '%s' "${{ github.event.release.body || inputs.body }}" | \
51+
BODY_SAFE=$(printf '%s' "$INPUT_BODY" | \
4852
sed 's/[_*[\]()~`>#+-=|{}.!\\]/\\&/g')
53+
TAG_SAFE=$(printf '%s' "$TAG" | sed 's/[_*[\]()~`>#+=|{}.!\\-]/\\&/g')
54+
URL_SAFE=$(printf '%s' "$URL" | sed 's/[_*[\]()~`>#+=|{}.!\\-]/\\&/g')
4955
5056
if [[ "$TAG" == *"-nightly"* ]]; then
5157
SUFFIX=" (Nightly Release)"
@@ -54,7 +60,7 @@ jobs:
5460
fi
5561
5662
# Announcement line — also escape for safety
57-
ANNOUNCE_SAFE="📢 Acode \[$TAG\]($URL) was just Released 🎉$SUFFIX!"
63+
ANNOUNCE_SAFE="📢 Acode \[$TAG_SAFE\]($URL_SAFE) was just Released 🎉$SUFFIX!"
5864
5965
echo "announce=$ANNOUNCE_SAFE" >> $GITHUB_OUTPUT
6066
echo "body_safe=$BODY_SAFE" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)