From 27babbcb0ea7251b9436a7dfb2973750e3e64c5c Mon Sep 17 00:00:00 2001 From: Zijun Yang Date: Mon, 9 Dec 2024 13:21:12 -0500 Subject: [PATCH] update action script --- .github/workflows/deploy.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c9f4535..c532fc7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -28,6 +28,26 @@ jobs: echo "code=$TOTP_CODE" >> $GITHUB_ENV - name: Send POST request to Verifier + id: send_post run: | - curl -X POST "${{ secrets.FLASK_VERIFIER_URL }}/verify" \ - -d "code=${{ env.code }}" + response=$(curl -X POST "${{ secrets.FLASK_VERIFIER_URL }}/verify" \ + -d "code=${{ env.code }}" -s) + echo "Response: $response" + echo "$response" > response.json + success=$(echo $response | jq -r '.success') + message=$(echo $response | jq -r '.message') + + if [[ "$success" == "false" ]]; then + echo "Message: $message" + echo "Try manual deployment" + exit 1 + else + echo "Verification succeeded." + fi + env: + code: ${{ env.code }} + FLASK_VERIFIER_URL: ${{ secrets.FLASK_VERIFIER_URL }} + + - name: Handle Success + if: steps.send_post.outputs.success == 'true' + run: echo "Action completed successfully!"