From 81dced6ada781562c693ffa6f139477f7b81dff5 Mon Sep 17 00:00:00 2001 From: Micheal Wilkinson Date: Sat, 21 Mar 2026 20:14:08 +0000 Subject: [PATCH] fix(publish): avoid heredoc parsing in composite json helper Replace the embedded python heredoc with python3 -c so the composite action remains valid YAML and shell across teacup parsing. --- publish/action.yml | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/publish/action.yml b/publish/action.yml index a131c33..5443dfa 100644 --- a/publish/action.yml +++ b/publish/action.yml @@ -44,28 +44,6 @@ runs: run: | set -euo pipefail - parse_release_id() { - local json_file="$1" - - if command -v python3 >/dev/null 2>&1; then - python3 - "$json_file" <<'PY' -import json -import sys - -with open(sys.argv[1], 'r', encoding='utf-8') as fh: - payload = json.load(fh) - -value = payload.get('id') -if isinstance(value, int): - print(value) -PY - return - fi - - # Fallback for environments without python3. - sed -n 's/.*"id"[[:space:]]*:[[:space:]]*\([0-9][0-9]*\).*/\1/p' "$json_file" | head -n 1 - } - provided="$(printf '%s' "${INPUT_VERSION:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')" if [[ -n "$provided" ]]; then normalized="${provided#v}" @@ -121,6 +99,18 @@ PY run: | set -euo pipefail + parse_release_id() { + local json_file="$1" + + if command -v python3 >/dev/null 2>&1; then + python3 -c 'import json, sys; payload = json.load(open(sys.argv[1], encoding="utf-8")); value = payload.get("id"); print(value if isinstance(value, int) else "")' "$json_file" + return + fi + + # Fallback for environments without python3. + sed -n 's/.*"id"[[:space:]]*:[[:space:]]*\([0-9][0-9]*\).*/\1/p' "$json_file" | head -n 1 + } + raw_token="$(printf '%s' "${TOKEN:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')" if [[ "$raw_token" =~ ^%\!t\(string=(.*)\)$ ]]; then raw_token="${BASH_REMATCH[1]}"