ci: Fix discussion answering github action workflow to escape the quote in the discussion content JSON

PiperOrigin-RevId: 805091905
This commit is contained in:
Xiang (Sean) Zhou
2025-09-09 15:42:34 -07:00
committed by Copybara-Service
parent e3422c616d
commit 43c96811da
+6 -1
View File
@@ -42,4 +42,9 @@ jobs:
REPO: 'adk-python'
INTERACTIVE: 0
PYTHONPATH: contributing/samples
run: python -m adk_answering_agent.main --discussion '${{ toJson(github.event.discussion) }}'
DISCUSSION_JSON: ${{ toJson(github.event.discussion) }}
run: |
# Replace single quotes with the sequence that allows them to be used in a single-quoted string
# This replaces ' with '\'', which ends the current single-quoted string, adds an escaped single quote, then starts a new single-quoted string
SAFE_JSON="${DISCUSSION_JSON//\'/\'\\\'\'}"
python -m adk_answering_agent.main --discussion '$SAFE_JSON'