Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 19 additions & 33 deletions .github/scripts/post-merge-validation-tracker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,20 @@ function tabTitleFor(repo, releaseLabel) {
return `pre-${releaseLabel} (${repoType(repo)})`;
}

function platformLabelFor(type) {
const t = String(type).toLowerCase();
if (t === 'mobile') return '📱 Mobile - Pull requests';
if (t === 'extension') return '🔌 Extension - Pull requests';
return t;
}

function headerRowFor(type) {
const isMobile = String(type).toLowerCase() === 'mobile';
const t = String(type).toLowerCase();
const isMobile = t === 'mobile';
const colG = isMobile ? 'Validated (Android)' : 'Validated (Chrome)';
const colH = isMobile ? 'Validated (iOS)' : 'Validated (Firefox)';
return [
'Pull Request',
platformLabelFor(type),
'Merged Time (UTC)',
'Author',
'PR Size',
Expand All @@ -74,13 +82,6 @@ function headerRowFor(type) {
];
}

function platformLabelFor(type) {
const t = String(type).toLowerCase();
if (t === 'mobile') return '📱 Mobile';
if (t === 'extension') return '🔌 Extension';
return t;
}

async function ensureSheetExists(authClient, title, platformType) {
const meta = await sheets.spreadsheets.get({
spreadsheetId,
Expand Down Expand Up @@ -129,23 +130,15 @@ async function createSheetFromTemplateOrBlank(authClient, sheetsList, title, pla
},
});
const newSheetId = duplicateRes.data.replies?.[0]?.duplicateSheet?.properties?.sheetId;
// Write platform label in A1 and platform-specific labels; keep row 2 headers from template to preserve formatting
// Write all platform-specific column headers into row 1 (preserves template cell formatting)
await sheets.spreadsheets.values.update({
spreadsheetId,
auth: authClient,
range: `${title}!A1:A1`,
valueInputOption: 'USER_ENTERED',
requestBody: { values: [[platformLabelFor(platformType)]] },
});
// Overwrite entire row 2 with headerRowFor(type)
Comment thread
cursor[bot] marked this conversation as resolved.
await sheets.spreadsheets.values.update({
spreadsheetId,
auth: authClient,
range: `${title}!A2:H2`,
range: `${title}!A1:H1`,
valueInputOption: 'USER_ENTERED',
requestBody: { values: [headerRowFor(platformType)] },
});
// Insert a blank row at index 2 (0-based) so data can start at row 4
// Insert a blank row at index 1 (0-based) so data can start at row 3
await sheets.spreadsheets.batchUpdate({
spreadsheetId,
auth: authClient,
Expand All @@ -159,7 +152,7 @@ async function createSheetFromTemplateOrBlank(authClient, sheetsList, title, pla
},
{
insertDimension: {
range: { sheetId: newSheetId, dimension: 'ROWS', startIndex: 2, endIndex: 3 },
range: { sheetId: newSheetId, dimension: 'ROWS', startIndex: 1, endIndex: 2 },
inheritFromBefore: false,
},
},
Expand All @@ -186,18 +179,11 @@ async function createSheetFromTemplateOrBlank(authClient, sheetsList, title, pla
},
});
const sheetId = addRes.data.replies?.[0]?.addSheet?.properties?.sheetId;
// Write platform label in A1 and dynamic headers in row 2
await sheets.spreadsheets.values.update({
spreadsheetId,
auth: authClient,
range: `${title}!A1:A1`,
valueInputOption: 'USER_ENTERED',
requestBody: { values: [[platformLabelFor(platformType)]] },
});
// Write all column headers into row 1 (no template to provide them)
await sheets.spreadsheets.values.update({
spreadsheetId,
auth: authClient,
range: `${title}!A2:H2`,
range: `${title}!A1:H1`,
valueInputOption: 'USER_ENTERED',
requestBody: { values: [headerRowFor(platformType)] },
});
Comment on lines 187 to 189
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve headers when creating a non-template sheet

In createSheetFromTemplateOrBlank, the fallback path (when no template tab exists) now only writes A1 and skips writing any column headers. This is a regression from the previous behavior, where A2:H2 was populated via headerRowFor(platformType). If template lookup fails (the exact case this branch handles), the generated tab has unlabeled validation columns, which makes the tracker hard to use and can lead to incorrect manual validation updates.

Useful? React with 👍 / 👎.

Comment thread
cursor[bot] marked this conversation as resolved.
Expand All @@ -224,7 +210,7 @@ async function readRows(authClient, title) {
const res = await sheets.spreadsheets.values.get({
spreadsheetId,
auth: authClient,
range: `${title}!A3:J`,
range: `${title}!A2:J`,
});
return res.data.values || [];
} catch (e) {
Expand All @@ -238,7 +224,7 @@ async function appendRows(authClient, title, rows) {
await sheets.spreadsheets.values.append({
spreadsheetId,
auth: authClient,
range: `${title}!A4:J`,
range: `${title}!A3:J`,
valueInputOption: 'USER_ENTERED',
insertDataOption: 'INSERT_ROWS',
requestBody: { values: rows },
Expand Down Expand Up @@ -838,7 +824,7 @@ async function processTab(authClient, title, entries, platformType) {
requests: [
{
deleteDimension: {
range: { sheetId, dimension: 'ROWS', startIndex: 2, endIndex: 3 },
range: { sheetId, dimension: 'ROWS', startIndex: 1, endIndex: 2 },
},
},
],
Expand Down