small fix commit #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: On PR Validation | |
on: | |
pull_request: | |
jobs: | |
sleep-job: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Wait for entity | |
run: | | |
token=$(curl -s 'https://api.getport.io/v1/auth/access_token' \ | |
-H 'Content-Type: application/json' \ | |
-H 'Accept: application/json' \ | |
-d '{ | |
"clientId": "${{ secrets.PORT_CLIENT_ID }}", | |
"clientSecret": "${{ secrets.PORT_CLIENT_SECRET }}" | |
}' | jq -r '.accessToken') | |
echo "Waiting for entity to be ready" | |
counter=0 | |
max_retries=120 # 10 minutes / 5 seconds | |
while [ $counter -lt $max_retries ]; do | |
response=$(curl -s 'https://api.getport.io/v1/blueprints/lock_run/entities/pr' \ | |
-H "Authorization: $token") | |
continue=$(echo $response | jq -r '.entity.properties.continue') | |
if [ "$continue" == "true" ]; then | |
echo "Entity is ready after $counter attempts." | |
succeed=$(echo $response | jq -r '.entity.properties.succeed') | |
if [ "$succeed" == "true" ]; then | |
echo "Entity succeeded." | |
break | |
else | |
echo "Entity did not succeed." | |
exit 1 | |
fi | |
fi | |
counter=$((counter + 1)) | |
echo "Attempt $counter: Entity not ready yet. Sleeping for 5 seconds." | |
sleep 5 | |
done | |
if [ $counter -eq $max_retries ]; then | |
echo "Entity was not ready after 10 minutes." | |
exit 1 | |
fi |