From 3d4073f9e2cc0fd9ea631a572ed480193b7ba59a Mon Sep 17 00:00:00 2001 From: Aleksei Simatov Date: Thu, 29 May 2025 13:46:15 +0700 Subject: [PATCH 1/2] Feature: Add user login for lists --- README.md | 10 +++++----- build/index.js | 8 +++++--- package.json | 2 +- src/converters/types.ts | 1 + src/converters/utils/preparePullRequestTimeline.ts | 2 ++ src/view/utils/createPullRequestQualityTable.ts | 2 +- src/view/utils/createTimelineContent.ts | 2 +- src/view/utils/createTotalTable.ts | 2 +- 8 files changed, 17 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1434dd9..d04217c 100644 --- a/README.md +++ b/README.md @@ -230,9 +230,9 @@ line [0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 11, 8, 9, 11, 10, 9, 6, 5, 6, 1, 1, 0, 0, 0] Identifies standout pull requests, helping quickly locate the most pending PRs at various stages, the largest and the most commented ones. This facilitates analysis by focusing on the most significant cases. Here is an example of the most commented PRs. -1. [Feature: PR Title 1(example)(31)](https://github.com/AlexSim93/pull-request-analytics-action/pull/15) -2. [Feature: PR Title 2(example)(27)](https://github.com/AlexSim93/pull-request-analytics-action/pull/15) -3. [Feature: PR Title 3(example)(25)](https://github.com/AlexSim93/pull-request-analytics-action/pull/15) +1. [Feature: PR Title 1(example)(31)(Author: AlexSim93)](https://github.com/AlexSim93/pull-request-analytics-action/pull/15) +2. [Feature: PR Title 2(example)(27)(Author: AlexSim93)](https://github.com/AlexSim93/pull-request-analytics-action/pull/15) +3. [Feature: PR Title 3(example)(25)(Author: AlexSim93)](https://github.com/AlexSim93/pull-request-analytics-action/pull/15) ## Getting started @@ -302,8 +302,8 @@ Below is a table outlining the various configuration parameters available for ** | Parameter Name | Description | Default Value | | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | | `GITHUB_TOKEN` | `GITHUB_TOKEN` or personal access token. **repo** and **read:org** scopes required for **personal access token(classic)**. For scenarios involving data collection from multiple repositories or handling a large number of pull requests, it's recommended to use a **personal access token (classic)**. This parameter is **required** | - | -| `GITHUB_OWNER_FOR_ISSUE` | Owner of the repository where an issue with the report needs to be created. This parameter is mandatory if `EXECUTION_OUTCOME` includes `new-issue` or `existing-issue` values. | - | -| `GITHUB_REPO_FOR_ISSUE` | The repository where an issue with the report needs to be created. This parameter is mandatory if `EXECUTION_OUTCOME` includes `new-issue` or `existing-issue` values. | - | +| `GITHUB_OWNER_FOR_ISSUE` | Owner of the repository where an issue with the report needs to be created. This parameter is **required** if `EXECUTION_OUTCOME` includes `new-issue` or `existing-issue` values. | - | +| `GITHUB_REPO_FOR_ISSUE` | The repository where an issue with the report needs to be created. This parameter is **required** if `EXECUTION_OUTCOME` includes `new-issue` or `existing-issue` values. | - | | `GITHUB_OWNERS_REPOS` | Repositories to collect data from. Enter values in the format `owner/repo`, separated by commas. Either `GITHUB_OWNERS_REPOS` or `ORGANIZATIONS` must be set. Example: `owner/repo, owner/another-repo` | - | | `ORGANIZATIONS` | Organizations from whose repositories data needs to be collected., separated by commas. Repositories from these organizations will be added to the `GITHUB_OWNERS_REPOS` list to create an array with unique repositories. Either `GITHUB_OWNERS_REPOS` or `ORGANIZATIONS` must be set. | - | | `SHOW_STATS_TYPES` | Stats types that should be displayed in report. Values must be separated by commas. Can take values: `timeline`, `workload`, `pr-quality`, `code-review-engagement`, `response-time`. Example: `timeline, workload, pr-quality, code-review-engagement, response-time` | `timeline, workload, pr-quality, code-review-engagement, response-time` | diff --git a/build/index.js b/build/index.js index a0b6646..92f38d2 100644 --- a/build/index.js +++ b/build/index.js @@ -1442,6 +1442,7 @@ exports.preparePullRequestStats = preparePullRequestStats; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.preparePullRequestTimeline = void 0; const utils_1 = __nccwpck_require__(41002); +const constants_1 = __nccwpck_require__(95354); const calculations_1 = __nccwpck_require__(16576); const calcDifferenceInMinutes_1 = __nccwpck_require__(72317); const calcPRsize_1 = __nccwpck_require__(8722); @@ -1526,6 +1527,7 @@ const preparePullRequestTimeline = (pullRequestInfo, pullRequestReviews = [], re comments: pullRequestInfo?.review_comments, sizePoints: (0, calcPRsize_1.calcPRsize)(pullRequestInfo?.additions, pullRequestInfo?.deletions), additions: pullRequestInfo?.additions || 0, + author: pullRequestInfo?.user?.login || constants_1.invalidUserLogin, deletions: pullRequestInfo?.deletions || 0, timeToReview: timeToReview || 0, timeToApprove: timeToApprove ? timeToApprove - (timeToReview || 0) : 0, @@ -3062,7 +3064,7 @@ const createPullRequestQualityTable = (data, users, date) => { ?.sort((a, b) => (b.comments || 0) - (a.comments || 0)) .slice(0, parseInt((0, utils_1.getValueAsIs)("TOP_LIST_AMOUNT"))) .map((item) => ({ - text: `${item.title}(${item.comments || 0})`, + text: `${item.title}(${item.comments || 0})(Author: ${item.author})`, link: item.link || "", })) || []; return [ @@ -3294,7 +3296,7 @@ const createTimelineContent = (data, users, date) => { ?.sort((a, b) => b[milestone] - a[milestone]) .slice(0, parseInt((0, utils_1.getValueAsIs)("TOP_LIST_AMOUNT"))) .map((item) => ({ - text: `${item.title}(${(0, formatMinutesDuration_1.formatMinutesDuration)(item[milestone]) || "-"})`, + text: `${item.title}(${(0, formatMinutesDuration_1.formatMinutesDuration)(item[milestone]) || "-"})(Author: ${item.author})`, link: item.link || "", })) || []; return (0, common_1.createList)(milestoneTitle[milestone], items); @@ -3692,7 +3694,7 @@ const createTotalTable = (data, users, date) => { ?.sort((a, b) => (b.sizePoints || 0) - (a.sizePoints || 0)) .slice(0, parseInt((0, utils_1.getValueAsIs)("TOP_LIST_AMOUNT"))) .map((item) => ({ - text: `${item.title}(+${item.additions}/-${item.deletions})`, + text: `${item.title}(+${item.additions}/-${item.deletions})(Author: ${item.author})`, link: item.link || "", })) || []; return [ diff --git a/package.json b/package.json index 55d22db..2ea34c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pull-request-analytics-action", - "version": "4.6.0", + "version": "4.6.1", "description": "Generates detailed PR analytics reports within GitHub, focusing on review efficiency and team performance.", "main": "build/index.js", "scripts": { diff --git a/src/converters/types.ts b/src/converters/types.ts index 1554041..903694c 100644 --- a/src/converters/types.ts +++ b/src/converters/types.ts @@ -41,6 +41,7 @@ type PullRequestTimelineInfo = { sizePoints: number; additions: number; deletions: number; + author?: string; }; type Discussion = { diff --git a/src/converters/utils/preparePullRequestTimeline.ts b/src/converters/utils/preparePullRequestTimeline.ts index 866985d..8a67a3f 100644 --- a/src/converters/utils/preparePullRequestTimeline.ts +++ b/src/converters/utils/preparePullRequestTimeline.ts @@ -1,5 +1,6 @@ import { getMultipleValuesInput, getValueAsIs } from "../../common/utils"; import { makeComplexRequest } from "../../requests"; +import { invalidUserLogin } from "../constants"; import { Collection } from "../types"; import { calcDraftTime, @@ -151,6 +152,7 @@ export const preparePullRequestTimeline = ( pullRequestInfo?.deletions ), additions: pullRequestInfo?.additions || 0, + author: pullRequestInfo?.user?.login || invalidUserLogin, deletions: pullRequestInfo?.deletions || 0, timeToReview: timeToReview || 0, timeToApprove: timeToApprove ? timeToApprove - (timeToReview || 0) : 0, diff --git a/src/view/utils/createPullRequestQualityTable.ts b/src/view/utils/createPullRequestQualityTable.ts index d0ba088..7700093 100644 --- a/src/view/utils/createPullRequestQualityTable.ts +++ b/src/view/utils/createPullRequestQualityTable.ts @@ -47,7 +47,7 @@ export const createPullRequestQualityTable = ( ?.sort((a, b) => (b.comments || 0) - (a.comments || 0)) .slice(0, parseInt(getValueAsIs("TOP_LIST_AMOUNT"))) .map((item) => ({ - text: `${item.title}(${item.comments || 0})`, + text: `${item.title}(${item.comments || 0})(Author: ${item.author})`, link: item.link || "", })) || []; diff --git a/src/view/utils/createTimelineContent.ts b/src/view/utils/createTimelineContent.ts index b0f1866..8de527d 100644 --- a/src/view/utils/createTimelineContent.ts +++ b/src/view/utils/createTimelineContent.ts @@ -31,7 +31,7 @@ export const createTimelineContent = ( .map((item) => ({ text: `${item.title}(${ formatMinutesDuration(item[milestone]) || "-" - })`, + })(Author: ${item.author})`, link: item.link || "", })) || []; return createList(milestoneTitle[milestone], items); diff --git a/src/view/utils/createTotalTable.ts b/src/view/utils/createTotalTable.ts index 0586f43..d6040c0 100644 --- a/src/view/utils/createTotalTable.ts +++ b/src/view/utils/createTotalTable.ts @@ -46,7 +46,7 @@ export const createTotalTable = ( ?.sort((a, b) => (b.sizePoints || 0) - (a.sizePoints || 0)) .slice(0, parseInt(getValueAsIs("TOP_LIST_AMOUNT"))) .map((item) => ({ - text: `${item.title}(+${item.additions}/-${item.deletions})`, + text: `${item.title}(+${item.additions}/-${item.deletions})(Author: ${item.author})`, link: item.link || "", })) || []; From 3dd1c3b9e3c440079dd69f422bcc394db880db7b Mon Sep 17 00:00:00 2001 From: Aleksei Simatov Date: Thu, 29 May 2025 13:54:11 +0700 Subject: [PATCH 2/2] Feature: fix types --- src/converters/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/converters/types.ts b/src/converters/types.ts index 903694c..e054943 100644 --- a/src/converters/types.ts +++ b/src/converters/types.ts @@ -41,7 +41,7 @@ type PullRequestTimelineInfo = { sizePoints: number; additions: number; deletions: number; - author?: string; + author: string; }; type Discussion = {