Skip to content

Commit

Permalink
Feature: Add team requests support
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSim93 committed Jul 20, 2024
1 parent 85b9969 commit 55ab2a5
Show file tree
Hide file tree
Showing 10 changed files with 2,234 additions and 234 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pull request analytics action

![Version](https://img.shields.io/badge/version-3.1.0-blue) ![License](https://img.shields.io/badge/license-MIT-green)
![Version](https://img.shields.io/badge/version-3.1.1-blue) ![License](https://img.shields.io/badge/license-MIT-green)

**pull-request-analytics-action**: A powerful tool for analyzing the effectiveness of both teams and individual developers. This action generates reports based on data from pull requests, code reviews, and comments, enabling you to identify your team's strengths as well as areas needing improvement. The statistics collected by this GitHub Action can be displayed in the form of tables and graphs or passed on for further operations as markdown or a data collection.

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Pull Request Analytics"
author: "Aleksei Simatov"
description: "Generates detailed PR analytics reports within GitHub, focusing on review efficiency and team performance."
description: "Provides informative reports on team and developer metrics, based on data from pull requests and code reviews"
branding:
icon: "trending-up"
color: "orange"
Expand Down
2,076 changes: 1,966 additions & 110 deletions build/index.js

Large diffs are not rendered by default.

17 changes: 15 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pull-request-analytics-action",
"version": "3.1.0",
"version": "3.1.1",
"description": "Generates detailed PR analytics reports within GitHub, focusing on review efficiency and team performance.",
"main": "build/index.js",
"scripts": {
Expand All @@ -19,6 +19,7 @@
"@octokit/plugin-throttling": "^8.1.3",
"date-fns": "^2.30.0",
"dotenv": "^16.3.1",
"lodash": "^4.17.21",
"mixpanel": "^0.18.0",
"octokit": "^3.1.2"
},
Expand All @@ -31,6 +32,7 @@
"devDependencies": {
"@tsconfig/node20": "^20.1.2",
"@types/jest": "^29.5.10",
"@types/lodash": "^4.17.7",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"@vercel/ncc": "^0.38.1",
Expand Down
37 changes: 22 additions & 15 deletions src/converters/collectData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { format, parseISO } from "date-fns";
import set from "lodash/set";
import get from "lodash/get";

import { makeComplexRequest } from "../requests";
import { Collection } from "./types";
import {
Expand Down Expand Up @@ -54,25 +57,29 @@ export const collectData = (
: invalidDate;

const userKey = pullRequest.user?.login || invalidUserLogin;
[userKey, ...(teams[userKey] || [])].forEach((key) => {
if (!collection[key]) {
collection[key] = {};
}
});
prepareRequestedReviews(reviewRequests, collection, dateKey, teams);

["total", userKey, ...(teams[userKey] || [])].forEach((key) => {
["total", dateKey].forEach((innerKey) => {
collection[key][innerKey] = preparePullRequestInfo(
pullRequest,
collection[key][innerKey]
set(
collection,
[key, innerKey],
preparePullRequestInfo(
pullRequest,
get(collection, [key, innerKey], {})
)
);
collection[key][innerKey] = preparePullRequestTimeline(
pullRequest,
reviews,
reviewRequests?.[0],
statuses,
collection[key][innerKey]

set(
collection,
[key, innerKey],
preparePullRequestTimeline(
pullRequest,
reviews,
reviewRequests?.[0],
statuses,
get(collection, [key, innerKey], {})
)
);
});
});
Expand Down Expand Up @@ -104,7 +111,7 @@ export const collectData = (

Object.entries(collection).map(([key, value]) => {
Object.entries(value).forEach(([innerKey, innerValue]) => {
collection[key][innerKey] = preparePullRequestStats(innerValue);
set(collection, [key, innerKey], preparePullRequestStats(innerValue));
});
});

Expand Down
Loading

0 comments on commit 55ab2a5

Please sign in to comment.