Skip to content

Commit 8c7fcd1

Browse files
DeanChensjcopybara-github
authored andcommitted
refactor(ci): Optimize workflows and secure JSON passing
1. Enable caching for `setup-uv` in `continuous-integration.yml` and `release-publish.yml` to speed up CI runs. 2. Secure JSON passing in `discussion_answering.yml` by using an environment variable instead of writing it via inline bash heredoc to prevent potential script injection. Co-authored-by: Shangjie Chen <deanchen@google.com> PiperOrigin-RevId: 940546688
1 parent 59970b6 commit 8c7fcd1

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/continuous-integration.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ jobs:
6767

6868
- name: Install uv
6969
uses: astral-sh/setup-uv@v7
70+
with:
71+
enable-cache: true
7072

7173
- name: Generate Baseline
7274
env:
@@ -134,6 +136,8 @@ jobs:
134136

135137
- name: Install the latest version of uv
136138
uses: astral-sh/setup-uv@v7
139+
with:
140+
enable-cache: true
137141

138142
- name: Install dependencies
139143
run: |

.github/workflows/discussion_answering.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ jobs:
6565
REPO: 'adk-python'
6666
INTERACTIVE: 0
6767
PYTHONPATH: contributing/samples/adk_team
68+
DISCUSSION_JSON: ${{ toJson(github.event.discussion) }}
6869
run: |
69-
# Write discussion data to temporary file to avoid secret masking issues
70-
cat > /tmp/discussion.json << 'EOF'
71-
${{ toJson(github.event.discussion) }}
72-
EOF
70+
python -c "import os; open('/tmp/discussion.json', 'w').write(os.environ['DISCUSSION_JSON'])"
7371
python -m adk_answering_agent.main --discussion-file /tmp/discussion.json

.github/workflows/release-publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
uses: astral-sh/setup-uv@v7
7171
with:
7272
version: "latest"
73+
enable-cache: true
7374

7475
- name: Set up Python
7576
uses: actions/setup-python@v6

0 commit comments

Comments
 (0)