fix: wait for molecule tests before auto-merge attempt
CI / validate (pull_request) Successful in 1m39s
CI / molecule-tests (3) (pull_request) Successful in 6m9s
CI / molecule-tests (2) (pull_request) Successful in 6m18s
CI / molecule-tests (1) (pull_request) Successful in 6m52s
CI / molecule-tests (4) (pull_request) Successful in 8m51s
CI / auto-merge (pull_request) Successful in 3m11s

This commit is contained in:
Emil Simeonov
2026-08-24 05:03:51 +02:00
parent 4083835ca3
commit 8b751e4eff
+43
View File
@@ -295,6 +295,49 @@ jobs:
--checklist-confirmed \
--checklist-categories 1,2,3,4,5,6,7,8,9,10,11,12,13 \
--body "Auto-approved: all CI checks passed (validate, molecule-tests)."
- name: Wait for molecule tests to complete
env:
CI_GITEA_API_TOKEN: ${{ secrets.CI_GITEA_API_TOKEN }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
. .venv/bin/activate 2>/dev/null || true
# Poll commit status until all required checks pass or fail
MAX_WAIT=600 # 10 minutes
ELAPSED=0
while [ $ELAPSED -lt $MAX_WAIT ]; do
STATUS=$(curl -s -H "Authorization: token $CI_GITEA_API_TOKEN" \
"https://git.oblachno.oblachno.fyi/api/v1/repos/${{ github.repository }}/commits/$HEAD_SHA/status" \
| python3 -c "
import sys,json
d=json.load(sys.stdin)
statuses={s['context']:s['status'] for s in d.get('statuses',[])}
# Check if all molecule-tests contexts are terminal (success/failure)
mol_contexts=[k for k in statuses if 'molecule-tests' in k]
if not mol_contexts:
print('pending')
elif all(statuses[k] in ('success','failure') for k in mol_contexts):
if any(statuses[k]=='failure' for k in mol_contexts):
print('failure')
else:
print('success')
else:
print('pending')
")
echo "Molecule tests status: $STATUS (elapsed: ${ELAPSED}s)"
if [ "$STATUS" = "success" ]; then
echo "All molecule tests passed."
break
elif [ "$STATUS" = "failure" ]; then
echo "ERROR: Molecule tests failed. Aborting auto-merge."
exit 1
fi
sleep 30
ELAPSED=$((ELAPSED + 30))
done
if [ $ELAPSED -ge $MAX_WAIT ]; then
echo "ERROR: Timed out waiting for molecule tests."
exit 1
fi
- name: Squash merge with task ID
env:
CI_GITEA_API_TOKEN: ${{ secrets.CI_GITEA_API_TOKEN }}