Skip to content

Commit

Permalink
[chore] add section for components looking for new code owners (open-…
Browse files Browse the repository at this point in the history
…telemetry#33397)

**Description:**

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.

**Link to tracking Issue:**

open-telemetry#31419 

**Testing:**

```
act -j get_issues  -e <(echo '{"repository": {"owner": {"login": "your-github-username"}}}') -s [GITHUB_TOKEN=](09   i0)
```

---------

Co-authored-by: Curtis Robert <[email protected]>
Co-authored-by: Tyler Helmuth <[email protected]>
  • Loading branch information
3 people authored and cparkins committed Jul 11, 2024
1 parent 527fe83 commit 86cd2bc
Showing 1 changed file with 42 additions and 12 deletions.
54 changes: 42 additions & 12 deletions .github/workflows/scripts/generate-weekly-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,24 @@ async function getIssuesData({octokit, context}) {
return stats
}

function generateComponentsLookingForOwnersReportSection(lookingForOwners) {
let count = 0
let section = []

// NOTE: the newline after <summary> is required for markdown to render correctly
section.push(`<details>
<summary> Components </summary>\n`);
for (const components of Object.values(lookingForOwners)) {
count += Object.keys(components).length
for (const [componentName, metadatafilePath] of Object.entries(components)) {
section.push(`- [ ] [${componentName}](${path.join("../blob/main/", path.dirname(metadatafilePath))}) `)
}
}

section.push(`</details>`)
return {count, section}
}

function generateReport({ issuesData, previousReport, componentData }) {
const out = [
`## Format`,
Expand Down Expand Up @@ -228,9 +246,10 @@ function generateReport({ issuesData, previousReport, componentData }) {

// generate report for components
out.push('\n## Components Report', '<ul>');
for (const lbl of Object.keys(componentData)) {
var {byStatus, lookingForOwners} = componentData
for (const lbl of Object.keys(byStatus)) {
const section = [``];
const data = componentData[lbl];
const data = byStatus[lbl];
const count = Object.keys(data).length;

section.push(`<li> ${lbl}: ${count}`);
Expand All @@ -247,6 +266,11 @@ function generateReport({ issuesData, previousReport, componentData }) {
section.push('</li>');
out.push(section.join('\n'));
}

let {count, section} = generateComponentsLookingForOwnersReportSection(lookingForOwners)
out.push(`<li> Seeking new code owners: ${count}`)
out.push(...section)
out.push('</li>')
out.push('</ul>');

const report = out.join('\n');
Expand Down Expand Up @@ -387,37 +411,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 }) {
Expand Down

0 comments on commit 86cd2bc

Please sign in to comment.