Pre-Merge Queue Workflow #29
Workflow file for this run
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: Pre-Merge Queue Workflow | |
on: | |
merge_group: | |
jobs: | |
e2e-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Wait for entity | |
run: | | |
echo "${{ toJson(github.event.merge_group) }}" | jq | |
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/merge' \ | |
-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 | |
sleep-job: | |
needs: e2e-tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Sleep for 5 minutes | |
run: sleep 300 |