Skip to content

Commit c0a86bc

Browse files
ci: resolve jq parse error in ip verification (#265)
2 parents adbc2b6 + 81fff4b commit c0a86bc

1 file changed

Lines changed: 17 additions & 14 deletions

File tree

.github/actions/deploy/action.yaml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,27 @@ runs:
4141
with:
4242
WG_CONFIG_FILE: ${{ inputs.secret }}
4343

44-
- name: Poll for IP Change
44+
- name: Wait for VPN IP Change
4545
run: |
46-
elapsed=0
47-
while true; do
48-
response=$(curl -s 'https://httpbin.org/ip' || echo '{"origin":""}')
49-
content=$(echo $response | jq -r '.origin')
50-
if [ "$content" == "${{ inputs.expected-ip }}" ]; then
51-
break
46+
expected_ip="${{ inputs.expected-ip }}"
47+
48+
for i in {1..6}; do
49+
current_ip=$(curl -s https://api.ipify.org || echo "")
50+
echo "Current IP: $current_ip, Expected: $expected_ip"
51+
52+
if [ "$current_ip" == "$expected_ip" ]; then
53+
echo "Success!"
54+
exit 0
5255
fi
53-
if [ $elapsed -ge 20 ]; then
54-
echo "Timeout reached!"
55-
exit 1
56+
57+
if [ $i -lt 6 ]; then
58+
echo "Polling.. Elapsed time: $((i * 5)) seconds"
59+
sleep 5
5660
fi
57-
echo "Polling.. Elapsed: $elapsed, IP: $content"
58-
sleep 5
59-
elapsed=$((elapsed + 5))
6061
done
61-
echo "Success!"
62+
63+
echo "Timeout reached!"
64+
exit 1
6265
shell: bash
6366

6467
- name: Deploy

0 commit comments

Comments
 (0)