Skip to content

Commit 1ece93e

Browse files
committed
Use env block for secure secret passing
1 parent fa5ee26 commit 1ece93e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

.github/workflows/ai-code-review.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ jobs:
3333
3434
- name: Code Review
3535
id: review
36+
env:
37+
API_KEY: ${{ secrets.AI_PROVIDER_API_KEY }}
38+
API_ENDPOINT: ${{ secrets.AI_PROVIDER_API_ENDPOINT }}
39+
MODEL: ${{ secrets.AI_PROVIDER_MODEL }}
3640
run: |
3741
set +x # Disable verbose mode to prevent secret leakage in logs
3842
DIFF=$(cat pr.diff | jq -Rs .)
@@ -43,12 +47,12 @@ jobs:
4347
HTTP_CODE=0
4448
4549
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
46-
HTTP_CODE=$(curl -s -o response.json -w "%{http_code}" ${{ secrets.ZAI_API_ENDPOINT }} \
47-
-H "Authorization: Bearer ${{ secrets.ZAI_API_KEY }}" \
50+
HTTP_CODE=$(curl -s -o response.json -w "%{http_code}" $API_ENDPOINT \
51+
-H "Authorization: Bearer $API_KEY" \
4852
-H "Content-Type: application/json" \
4953
-H "Accept-Language: en-US,en" \
5054
-d "{
51-
\"model\": \"${{ secrets.ZAI_MODEL }}\",
55+
\"model\": \"$MODEL\",
5256
\"messages\": [
5357
{
5458
\"role\": \"system\",

0 commit comments

Comments
 (0)