GRM-160: fix: wait for molecule tests before auto-merge attempt

This commit is contained in:
2026-08-12 13:51:47 +00:00
parent 3686ab5170
commit 8a85b2479f
+32
View File
@@ -307,6 +307,38 @@ 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
if: needs.validate.outputs.ansible-changed == 'true'
env:
CI_GITEA_API_TOKEN: ${{ secrets.CI_GITEA_API_TOKEN }}
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.number }}
run: |
. .venv/bin/activate 2>/dev/null || true
# Poll Gitea API for molecule-tests job status (max 20 min)
for i in $(seq 1 120); do
all_done=$(python3 -c "
import json,urllib.request
url='https://git.oblachno.oblachno.fyi/api/v1/repos/$REPOSITORY/actions/runs?limit=5&event=pull_request'
req=urllib.request.Request(url,headers={'Authorization':'token $CI_GITEA_API_TOKEN'})
runs=json.loads(urllib.request.urlopen(req).read())
for r in runs[:3]:
jobs_url=f'https://git.oblachno.oblachno.fyi/api/v1/repos/$REPOSITORY/actions/runs/{r[\"id\"]}/jobs'
jreq=urllib.request.Request(jobs_url,headers={'Authorization':'token $CI_GITEA_API_TOKEN'})
jobs=json.loads(urllib.request.urlopen(jreq).read())
for j in (jobs if isinstance(jobs,list) else jobs.get('jobs',[])):
if j.get('name','').startswith('molecule-tests') and j.get('status')!='completed':
print('WAITING'); break
else:
continue
break
else:
print('DONE')
")
echo "Poll $i: $all_done"
[ "$all_done" = "DONE" ] && break
sleep 10
done
- name: Squash merge with task ID
env:
CI_GITEA_API_TOKEN: ${{ secrets.CI_GITEA_API_TOKEN }}