27 lines
749 B
YAML
27 lines
749 B
YAML
name: '🧼 Telegram message escape'
|
|
description: 'Automatically escapes dots, dashes, and exclamation marks for Telegram MarkdownV2'
|
|
|
|
inputs:
|
|
message:
|
|
description: 'The raw text string to escape'
|
|
required: true
|
|
|
|
outputs:
|
|
escaped_message:
|
|
description: 'The safely escaped string ready for Telegram'
|
|
value: ${{ steps.escape.outputs.result }}
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- id: escape
|
|
shell: bash
|
|
env:
|
|
RAW_MESSAGE: ${{ inputs.message }}
|
|
run: |
|
|
ESCAPED_MESSAGE=$(echo "$RAW_MESSAGE" | sed "s/-/\\\\-/g" | sed "s/\./\\\\./g" | sed "s/!/\\\\!/g")
|
|
|
|
echo "result<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$ESCAPED_MESSAGE" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|