mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
fix(preview-build): resolve slug from code/<slug> label (fallback id/<slug> and marker) in release stage
This commit is contained in:
@@ -201,8 +201,17 @@ jobs:
|
||||
const b = pull.head.ref || '';
|
||||
const im = b.match(/^issue-(\d+)$/); let issue_number = 0; if (im) issue_number = Number(im[1]);
|
||||
if (issue_number) {
|
||||
const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number, per_page: 100 });
|
||||
for (const c of comments) { const mm = (c.body || '').match(marker); if (mm) { slug = mm[1].toLowerCase(); break; } }
|
||||
try {
|
||||
const { data: iss } = await github.rest.issues.get({ owner, repo, issue_number });
|
||||
const labels = (iss.labels || []).map(l => (typeof l === 'string' ? l : l.name)).filter(Boolean);
|
||||
const codeLabel = labels.find(n => typeof n === 'string' && n.startsWith('code/'));
|
||||
const idLabel = labels.find(n => typeof n === 'string' && n.startsWith('id/'));
|
||||
if (codeLabel) slug = codeLabel.slice(5).toLowerCase(); else if (idLabel) slug = idLabel.slice(3).toLowerCase();
|
||||
} catch {}
|
||||
if (!slug) {
|
||||
const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number, per_page: 100 });
|
||||
for (const c of comments) { const mm = (c.body || '').match(marker); if (mm) { slug = mm[1].toLowerCase(); break; } }
|
||||
}
|
||||
}
|
||||
if (!slug) throw new Error('Missing codex-id marker on PR/issue.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user