deploy-workflow: create docker compose file
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6s
This commit is contained in:
@@ -15,34 +15,16 @@ runs:
|
|||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
- id: escape
|
- id: escape
|
||||||
shell: python
|
shell: bash
|
||||||
env:
|
env:
|
||||||
RAW_MESSAGE: ${{ inputs.message }}
|
RAW_MESSAGE: ${{ inputs.message }}
|
||||||
ESCAPED_MESSAGE: $GITHUB_OUTPUT
|
|
||||||
run: |
|
run: |
|
||||||
import os
|
MSG="$RAW_MESSAGE"
|
||||||
|
MSG="${MSG//-/\\-}"
|
||||||
|
MSG="${MSG//./\\.}"
|
||||||
|
MSG="${MSG//!/\\!}"
|
||||||
|
MSG="${MSG//\`/\\\\\\\`}"
|
||||||
|
|
||||||
raw_text = os.environ.get("RAW_MESSAGE", "")
|
echo "result<<EOF" >> $GITHUB_OUTPUT
|
||||||
output_file = os.environ.get("ESCAPED_MESSAGE")
|
echo "$MSG" >> $GITHUB_OUTPUT
|
||||||
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
def escape_text(text):
|
|
||||||
escape_chars = ["-", ".", "!"]
|
|
||||||
for char in escape_chars:
|
|
||||||
text = text.replace(char, f"\\{char}")
|
|
||||||
return text
|
|
||||||
|
|
||||||
parts = raw_text.split("`")
|
|
||||||
processed_parts = []
|
|
||||||
|
|
||||||
for i, part in enumerate(parts):
|
|
||||||
if i % 2 == 0:
|
|
||||||
processed_parts.append(escape_text(part))
|
|
||||||
else:
|
|
||||||
processed_parts.append(f"\\`{part}\\`")
|
|
||||||
|
|
||||||
escaped_text = "".join(processed_parts)
|
|
||||||
|
|
||||||
with open(output_file, "a", encoding="utf-8") as f:
|
|
||||||
f.write("result<<EOF\n")
|
|
||||||
f.write(f"{escaped_text}\n")
|
|
||||||
f.write("EOF\n")
|
|
||||||
|
|||||||
Reference in New Issue
Block a user