Skip to content

Commit

Permalink
only wait 10s in webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
sdcb committed Feb 14, 2025
1 parent 4ea20c0 commit 3f4ec09
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,28 @@ jobs:

- name: Upload to Minio
run: |
curl -X POST "https://chats-release-webhook.starworks.cc:88/sync/${{ github.run_id }}/${{ matrix.id }}" -N \
-H "Authorization: Basic $(echo -n "${{ secrets.CHATS_RELEASE_WEBHOOK_CREDENTIAL }}" | openssl base64)"
OUTPUT_LOG="curl_output.log"
echo "Triggering webhook, running in the background..."
nohup bash -c "curl -X POST \"https://chats-release-webhook.starworks.cc:88/sync/${GITHUB_RUN_ID}/${MATRIX_ID}\" -N -H \"Authorization: Basic \$(echo -n '${CREDENTIAL}' | openssl base64)\" | tee -a ${OUTPUT_LOG}" &
CURL_PID=$!
# Wait for a maximum of 10 seconds to detect a response
RESPONSE_OK=0
for i in $(seq 1 10); do
echo "Waiting for response... (${i}/10)"
if grep -q "开始同步..." "$OUTPUT_LOG"; then
echo "Response detected, assuming status code is 200. Exiting wait."
RESPONSE_OK=1
break
fi
sleep 1
done
if [ $RESPONSE_OK -ne 1 ]; then
echo "Timeout: Did not detect expected response within 10 seconds."
exit 1
fi
create-release:
if: needs.build-fe.outputs.is_release == 'true'
Expand Down

0 comments on commit 3f4ec09

Please sign in to comment.