ci: Fix discussion answering agent

a. dump the discussion content to a tmp file first to avoid github redaction of environment variable
b. instruct the agent to use get_discussion_and_comments only when discussion content json is not available.

PiperOrigin-RevId: 805581573
This commit is contained in:
Xiang (Sean) Zhou
2025-09-10 17:33:54 -07:00
committed by Copybara-Service
parent f96f0ebd0d
commit 0bc2ee64e3
3 changed files with 101 additions and 52 deletions
+5 -5
View File
@@ -46,9 +46,9 @@ jobs:
REPO: 'adk-python'
INTERACTIVE: 0
PYTHONPATH: contributing/samples
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'
# Write discussion data to temporary file to avoid secret masking issues
cat > /tmp/discussion.json << 'EOF'
${{ toJson(github.event.discussion) }}
EOF
python -m adk_answering_agent.main --discussion-file /tmp/discussion.json