Don't tag g-website or flakey CI bugs with ~unreleased bug tag, add x & y version handling (#39514)
e.g. #39380, #39308, #39618. We'll have more of these later. --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: iansltx <472804+iansltx@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot
iansltx
parent
c51c698830
commit
74239bf840
@@ -27,11 +27,8 @@ jobs:
|
||||
const issue = context.payload.issue;
|
||||
const labels = issue.labels.map(label => label.name);
|
||||
|
||||
const hasReleasedLabel = labels.some(label =>
|
||||
label.includes('~released bug') || label.includes('~unreleased bug')
|
||||
);
|
||||
|
||||
if (hasReleasedLabel) {
|
||||
const noopLabels = ['~released bug', '~unreleased bug', '#g-website', 'flaky-ci-tests'];
|
||||
if (labels.some(label => noopLabels.includes(label))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -111,19 +108,34 @@ jobs:
|
||||
// Normalize version for comparison
|
||||
// Remove common prefixes/suffixes and extract core version number
|
||||
const normalizeVersion = (version) => {
|
||||
// Extract version number pattern (e.g., "4.62.0" from "v4.62.0" or "4.62.0-123-abc")
|
||||
const match = version.match(/v?(\d+\.\d+\.\d+)/);
|
||||
return match ? match[1] : version;
|
||||
// First try to extract x.y.z pattern
|
||||
let match = version.match(/v?(\d+\.\d+\.\d+)/);
|
||||
if (match) return match[1];
|
||||
|
||||
// If no patch version, try x.y pattern and add .0
|
||||
match = version.match(/v?(\d+\.\d+)(?!\.\d)/);
|
||||
if (match) return match[1] + '.0';
|
||||
|
||||
return version;
|
||||
};
|
||||
|
||||
const normalizedReportedVersion = normalizeVersion(reportedVersion);
|
||||
|
||||
// Check if the reported version matches any released version
|
||||
const isReleased = releasedVersions.some(releasedVer => releasedVer === normalizedReportedVersion);
|
||||
// Split version string on "&" to handle multiple versions (e.g., "4.60 & 4.61")
|
||||
const reportedVersions = reportedVersion.split('&').map(v => v.trim());
|
||||
|
||||
// Check if ANY of the reported versions matches any released version
|
||||
let isReleased = false;
|
||||
for (const version of reportedVersions) {
|
||||
const normalizedVersion = normalizeVersion(version);
|
||||
if (releasedVersions.some(releasedVer => releasedVer === normalizedVersion)) {
|
||||
console.log(`Found released version: ${normalizedVersion}`);
|
||||
isReleased = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isReleased) {
|
||||
console.log(`Bug is released; leaving as-is`);
|
||||
return;
|
||||
}
|
||||
|
||||
await tagAsUnreleased();
|
||||
await tagAsUnreleased();
|
||||
|
||||
Reference in New Issue
Block a user