fix(api): match request branch with wildcard for owner approval check
The owner approval file is on request/tag-V1R3C0-self-loop-autonomous-engine
but the code was looking for request/tag-V1R3C0 (branch name not derivable
from version alone). Now uses glob pattern request/tag-{ver}* to find
the correct branch.
This commit is contained in:
@@ -256,19 +256,38 @@ class H(BaseHTTPRequestHandler):
|
||||
self.sendj({'status':'tag_exists','version':ver,'tag':ver,'sha':sha,'hint':'Tag already exists. No action needed.'})
|
||||
return
|
||||
|
||||
# Check if owner approval exists on the request branch
|
||||
# Check if owner approval exists - search multiple branch patterns
|
||||
owner_approval_path = f'baseline/promotions/{safe(ver)}.owner-approved.json'
|
||||
owner_approved = False
|
||||
approve_candidates = []
|
||||
if BARE_REPO.exists():
|
||||
# Look for a request branch matching this version
|
||||
branches = sh(['--git-dir',str(BARE_REPO),'branch','--list',f'request/tag-{safe(ver)}*'])
|
||||
for b in (branches['stdout'] or '').splitlines():
|
||||
b = b.strip().lstrip('*').strip()
|
||||
if b:
|
||||
approve_candidates.append(b)
|
||||
# Also check main branch or patch branches that might have the approval
|
||||
for b in ['main'] + approve_candidates:
|
||||
try:
|
||||
sh(['--git-dir',str(BARE_REPO),'cat-file','-e',f'request/tag-{safe(ver)}:{owner_approval_path}'], True)
|
||||
sh(['--git-dir',str(BARE_REPO),'cat-file','-e',f'{b}:{owner_approval_path}'], True)
|
||||
owner_approved = True
|
||||
break
|
||||
except RuntimeError:
|
||||
pass
|
||||
else:
|
||||
ov = (WS / owner_approval_path)
|
||||
if ov.exists() and ov.is_file():
|
||||
if not owner_approved:
|
||||
# Fallback: check the current workspace
|
||||
branches = sh(['branch','--list',f'request/tag-{safe(ver)}*'])
|
||||
for b in (branches['stdout'] or '').splitlines():
|
||||
b = b.strip().lstrip('*').strip()
|
||||
approve_candidates.append(b)
|
||||
for b in ['main'] + approve_candidates:
|
||||
try:
|
||||
sh(['cat-file','-e',f'{b}:{owner_approval_path}'])
|
||||
owner_approved = True
|
||||
break
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
if data.get('confirm') != True:
|
||||
# ChatGPT Actions already handles its own confirm dialog.
|
||||
|
||||
Reference in New Issue
Block a user