From ae891606813f58b950905b684838a61385ea60a8 Mon Sep 17 00:00:00 2001 From: Code and Solder Date: Thu, 10 Sep 2026 14:59:07 +0200 Subject: [PATCH] fix: render maintenance issue bodies as data --- .../scripts/render-maintenance-template.py | 19 +++++++++ .github/workflows/maintenance-queue.yml | 42 +++++++++++-------- 2 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 .github/scripts/render-maintenance-template.py diff --git a/.github/scripts/render-maintenance-template.py b/.github/scripts/render-maintenance-template.py new file mode 100644 index 0000000..c496eba --- /dev/null +++ b/.github/scripts/render-maintenance-template.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +"""Render maintenance issue Markdown without evaluating it as shell code.""" + +import os +import re +import sys + +PLACEHOLDER = re.compile(r"\$\{([A-Za-z_][A-Za-z0-9_]*)\}") + + +def substitute(match: re.Match[str]) -> str: + name = match.group(1) + try: + return os.environ[name] + except KeyError as exc: + raise SystemExit(f"missing template variable: {name}") from exc + + +sys.stdout.write(PLACEHOLDER.sub(substitute, sys.stdin.read())) diff --git a/.github/workflows/maintenance-queue.yml b/.github/workflows/maintenance-queue.yml index 7211df1..743fe96 100644 --- a/.github/workflows/maintenance-queue.yml +++ b/.github/workflows/maintenance-queue.yml @@ -131,15 +131,16 @@ jobs: existing="$(gh issue list --repo "$REPO" --state open --label "automation:dependency" --limit 200 --search "${marker} in:body" --json number --jq '.[0].number // empty')" details="$(jq -r '.changes[] | "- `\(.manifest)` / `\(.table)`: `\(.old)` → `\(.new)`"' <<<"$item")" - body="$(cat < - The passive dependency detector failed while running \`cargo upgrade\`. + The passive dependency detector failed while running `cargo upgrade`. - \`\`\`text + ```text ${log} - \`\`\` + ``` Repair the detector or repository state so passive dependency issue creation resumes. EOF @@ -229,17 +231,18 @@ jobs: if [[ "$CHANGED" == "true" ]]; then update_log="$(tail -n 250 /tmp/cargo-update.log)" stat="$(cat /tmp/lockfile-stat.txt)" - body="$(cat < - The passive dependency detector failed while running \`cargo update\`. + The passive dependency detector failed while running `cargo update`. - \`\`\`text + ```text ${log} - \`\`\` + ``` Repair the detector or repository state so passive lockfile issue creation resumes. EOF @@ -311,7 +315,9 @@ jobs: exit 0 fi - body="$(cat <