From 6142c0cc1421f334703020e4ce67dd27a926a20a Mon Sep 17 00:00:00 2001 From: Shengcun-Scanner <356718639+Shengcun-Scanner@users.noreply.github.com> Date: Mon, 16 Nov 2026 09:11:12 -0500 Subject: [PATCH] ci: read the notification fields from the environment The release body, issue title and pull request title are expanded into the script that builds the Telegram message, so any of them can run commands on the runner. Pass them through env instead. --- .github/workflows/notify.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml index 618bdbfb..ab6a3c76 100644 --- a/.github/workflows/notify.yml +++ b/.github/workflows/notify.yml @@ -15,6 +15,14 @@ jobs: steps: - name: Gather and Clean Data id: info + env: + RELEASE_BODY: ${{ github.event.release.body }} + RELEASE_TAG: ${{ github.event.release.tag_name }} + RELEASE_URL: ${{ github.event.release.html_url }} + ISSUE_TITLE: ${{ github.event.issue.title }} + ISSUE_URL: ${{ github.event.issue.html_url }} + PR_TITLE: ${{ github.event.pull_request.title }} + PR_URL: ${{ github.event.pull_request.html_url }} run: | CHAT_ID="${{ secrets.TELEGRAM_CHAT_ID }}" TOPIC_ID="${{ secrets.TELEGRAM_TOPIC_ID }}" @@ -31,9 +39,9 @@ jobs: TAG=$(echo "$DATA" | jq -r .tag_name) URL=$(echo "$DATA" | jq -r .html_url) else - RAW_BODY="${{ github.event.release.body }}" - TAG="${{ github.event.release.tag_name }}" - URL="${{ github.event.release.html_url }}" + RAW_BODY="$RELEASE_BODY" + TAG="$RELEASE_TAG" + URL="$RELEASE_URL" fi CLEAN_BODY=$(echo "$RAW_BODY" | \ @@ -59,7 +67,7 @@ jobs: { echo "full_message<$STATUS: $REPO" - echo "Issue: ${{ github.event.issue.title }}" + echo "Issue: $ISSUE_TITLE" echo "EOF" } >> "$GITHUB_OUTPUT" @@ -69,7 +77,7 @@ jobs: { echo "full_message<$STATUS: $REPO" - echo "PR: ${{ github.event.pull_request.title }}" + echo "PR: $PR_TITLE" echo "EOF" } >> "$GITHUB_OUTPUT" fi