From bed0aa992f9ba223e39477e6152cf6501e77a99e Mon Sep 17 00:00:00 2001 From: Luca Lanziani Date: Wed, 5 Jun 2024 18:42:24 +0200 Subject: [PATCH 1/5] [chore] add section for components looking for new code owners Add a section to the weekly report with the list of components looking for code owners based on the `status.codeowners.seeking_new` property of the metadata.yaml file. --- .../scripts/generate-weekly-report.js | 56 +++++++++++++++---- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/.github/workflows/scripts/generate-weekly-report.js b/.github/workflows/scripts/generate-weekly-report.js index 8633842738cc..d414c9e361b2 100644 --- a/.github/workflows/scripts/generate-weekly-report.js +++ b/.github/workflows/scripts/generate-weekly-report.js @@ -190,6 +190,26 @@ async function getIssuesData({octokit, context}) { return stats } +function generateComponentsLookingForOwnersReportSection(lookingForOwners) { + let count = 0 + let section = [] + + for (const [componetType, components] of Object.entries(lookingForOwners)) { + count += Object.keys(components).length + // NOTE: the newline after is required for markdown to render correctly + section.push(`
+ ${componetType}: ${Object.keys(components).length} \n`); + + for (const [component, path] of Object.entries(components)) { + section.push(`- [ ] [${component}](../blob/master/${path}) `) + } + + section.push(`
`) + } + + return {count, section} +} + function generateReport({ issuesData, previousReport, componentData }) { const out = [ `## Format`, @@ -228,9 +248,10 @@ function generateReport({ issuesData, previousReport, componentData }) { // generate report for components out.push('\n## Components Report', ''); const report = out.join('\n'); @@ -387,37 +413,43 @@ function processFiles(files) { } const processStatusResults = (results) => { - const filteredResults = {}; - + const byStatus = {}; + const lookingForOwners = {}; for (const component in results) { for (const name in results[component]) { const { path, data } = results[component][name]; - if (data && data.status && data.status.stability) { + if (data && data.status) { + if (data.status.stability) { const { stability } = data.status; const statuses = ['unmaintained', 'deprecated']; for (const status of statuses) { if (stability[status] && stability[status].length > 0) { - if (!filteredResults[status]) { - filteredResults[status] = {}; + if (!byStatus[status]) { + byStatus[status] = {}; } - filteredResults[status][name] = { path, stability: data.status.stability, component }; + byStatus[status][name] = { path, stability: data.status.stability, component }; } } + } + if (data.status.codeowners && data.status.codeowners.seeking_new) { + if (!(component in lookingForOwners)) { + lookingForOwners[component] = {} + } + lookingForOwners[component][name] = path + } } } } - return filteredResults; + return {byStatus, lookingForOwners}; }; async function processComponents() { const results = findFilesByName(`.`, 'metadata.yaml'); const resultsClean = processFiles(results) - const resultsWithStability = processStatusResults(resultsClean) - return resultsWithStability - + return processStatusResults(resultsClean) } async function main({ github, context }) { From 92e7a611a24bc3bdcc86c671779c14a7876dfdf9 Mon Sep 17 00:00:00 2001 From: Luca Lanziani Date: Mon, 10 Jun 2024 11:22:55 +0200 Subject: [PATCH 2/5] link to component folder instead of metadata.yaml file --- .github/workflows/scripts/generate-weekly-report.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scripts/generate-weekly-report.js b/.github/workflows/scripts/generate-weekly-report.js index d414c9e361b2..fe53ceebc36a 100644 --- a/.github/workflows/scripts/generate-weekly-report.js +++ b/.github/workflows/scripts/generate-weekly-report.js @@ -200,8 +200,8 @@ function generateComponentsLookingForOwnersReportSection(lookingForOwners) { section.push(`
${componetType}: ${Object.keys(components).length} \n`); - for (const [component, path] of Object.entries(components)) { - section.push(`- [ ] [${component}](../blob/master/${path}) `) + for (const [componentName, metadatafilePath] of Object.entries(components)) { + section.push(`- [ ] [${componentName}](${path.join("../blob/master/", path.dirname(metadatafilePath))}) `) } section.push(`
`) From 3137f7dafd8ed27f9ba4e06d2855d63117d946e2 Mon Sep 17 00:00:00 2001 From: Luca Lanziani Date: Mon, 10 Jun 2024 22:36:22 +0200 Subject: [PATCH 3/5] Update .github/workflows/scripts/generate-weekly-report.js Co-authored-by: Curtis Robert --- .github/workflows/scripts/generate-weekly-report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scripts/generate-weekly-report.js b/.github/workflows/scripts/generate-weekly-report.js index fe53ceebc36a..188e12bacae4 100644 --- a/.github/workflows/scripts/generate-weekly-report.js +++ b/.github/workflows/scripts/generate-weekly-report.js @@ -201,7 +201,7 @@ function generateComponentsLookingForOwnersReportSection(lookingForOwners) { ${componetType}: ${Object.keys(components).length} \n`); for (const [componentName, metadatafilePath] of Object.entries(components)) { - section.push(`- [ ] [${componentName}](${path.join("../blob/master/", path.dirname(metadatafilePath))}) `) + section.push(`- [ ] [${componentName}](${path.join("../blob/main/", path.dirname(metadatafilePath))}) `) } section.push(``) From b9e69c5821c0d4d56dcaaab983751e49f431a631 Mon Sep 17 00:00:00 2001 From: Luca Lanziani Date: Tue, 11 Jun 2024 22:57:23 +0200 Subject: [PATCH 4/5] Update .github/workflows/scripts/generate-weekly-report.js Co-authored-by: Curtis Robert --- .github/workflows/scripts/generate-weekly-report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scripts/generate-weekly-report.js b/.github/workflows/scripts/generate-weekly-report.js index 188e12bacae4..0bac41215606 100644 --- a/.github/workflows/scripts/generate-weekly-report.js +++ b/.github/workflows/scripts/generate-weekly-report.js @@ -270,7 +270,7 @@ function generateReport({ issuesData, previousReport, componentData }) { } let {count, section} = generateComponentsLookingForOwnersReportSection(lookingForOwners) - out.push(`
  • looking for owners: ${count}`) + out.push(`
  • Seeking new code owners: ${count}`) out.push(...section) out.push('
  • ') out.push(''); From 40b8ca7abaf7cce745bc2ae67cae5f5c76216a49 Mon Sep 17 00:00:00 2001 From: Luca Lanziani Date: Wed, 19 Jun 2024 22:16:28 +0200 Subject: [PATCH 5/5] Fix typo and create a single 'Components' element --- .github/workflows/scripts/generate-weekly-report.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/scripts/generate-weekly-report.js b/.github/workflows/scripts/generate-weekly-report.js index 0bac41215606..f496418e6997 100644 --- a/.github/workflows/scripts/generate-weekly-report.js +++ b/.github/workflows/scripts/generate-weekly-report.js @@ -194,19 +194,17 @@ function generateComponentsLookingForOwnersReportSection(lookingForOwners) { let count = 0 let section = [] - for (const [componetType, components] of Object.entries(lookingForOwners)) { + // NOTE: the newline after is required for markdown to render correctly + section.push(`
    + Components \n`); + for (const components of Object.values(lookingForOwners)) { count += Object.keys(components).length - // NOTE: the newline after is required for markdown to render correctly - section.push(`
    - ${componetType}: ${Object.keys(components).length} \n`); - for (const [componentName, metadatafilePath] of Object.entries(components)) { section.push(`- [ ] [${componentName}](${path.join("../blob/main/", path.dirname(metadatafilePath))}) `) } - - section.push(`
    `) } + section.push(`
    `) return {count, section} }