-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
593c720
commit 27b5bb7
Showing
25 changed files
with
433 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42002,28 +42002,73 @@ const STATS = { | |
totalReviews: { | ||
id: 'totalReviews', | ||
sortOrder: 'DESC', | ||
parser: noParse, | ||
parser: toFixed(0), | ||
}, | ||
totalComments: { | ||
id: 'totalComments', | ||
sortOrder: 'DESC', | ||
parser: toFixed(0), | ||
}, | ||
timeToReview: { | ||
id: 'timeToReview', | ||
sortOrder: 'ASC', | ||
parser: durationToString, | ||
}, | ||
totalComments: { | ||
id: 'totalComments', | ||
sortOrder: 'DESC', | ||
parser: noParse, | ||
}, | ||
commentsPerReview: { | ||
id: 'commentsPerReview', | ||
sortOrder: 'DESC', | ||
parser: toFixed(2), | ||
}, | ||
reviewedAdditions: { | ||
id: 'reviewedAdditions', | ||
sortOrder: 'DESC', | ||
parser: toFixed(0), | ||
}, | ||
reviewedDeletions: { | ||
id: 'reviewedDeletions', | ||
sortOrder: 'DESC', | ||
parser: toFixed(0), | ||
}, | ||
reviewedLines: { | ||
id: 'reviewedLines', | ||
sortOrder: 'DESC', | ||
parser: toFixed(0), | ||
}, | ||
openedPullRequests: { | ||
id: 'openedPullRequests', | ||
sortOrder: 'DESC', | ||
parser: noParse, | ||
}, | ||
totalObservations: { | ||
id: 'totalObservations', | ||
sortOrder: 'DESC', | ||
parser: toFixed(0), | ||
}, | ||
medianObservations: { | ||
id: 'medianObservations', | ||
sortOrder: 'DESC', | ||
parser: toFixed(2), | ||
}, | ||
revisionSuccessRate: { | ||
id: 'revisionSuccessRate', | ||
sortOrder: 'DESC', | ||
parser: toFixed(2), | ||
}, | ||
additions: { | ||
id: 'additions', | ||
sortOrder: 'DESC', | ||
parser: toFixed(0), | ||
}, | ||
deletions: { | ||
id: 'deletions', | ||
sortOrder: 'DESC', | ||
parser: toFixed(0), | ||
}, | ||
lines: { | ||
id: 'lines', | ||
sortOrder: 'DESC', | ||
parser: toFixed(0), | ||
}, | ||
}; | ||
|
||
const VALID_STATS = Object.keys(STATS); | ||
|
@@ -42252,11 +42297,15 @@ const PRS_QUERY = ` | |
node { | ||
... on PullRequest { | ||
id | ||
additions | ||
deletions | ||
publishedAt | ||
author { ...ActorFragment } | ||
reviews(first: 100) { | ||
nodes { | ||
id | ||
body | ||
state | ||
submittedAt | ||
commit { pushedDate } | ||
comments { totalCount } | ||
|
@@ -43043,13 +43092,40 @@ module.exports = async ({ | |
/***/ }), | ||
|
||
/***/ 8216: | ||
/***/ ((module) => { | ||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { | ||
|
||
const { sum, median, divide } = __nccwpck_require__(5494); | ||
|
||
const getProperty = (list, prop) => list.map((el) => el[prop]); | ||
|
||
const removeOwnPulls = ({ isOwnPull }) => !isOwnPull; | ||
|
||
const removeWithEmptyId = ({ id }) => !!id; | ||
|
||
module.exports = (pulls) => { | ||
const openedPullRequests = pulls.length; | ||
const reviews = pulls | ||
.reduce((acc, pull) => ([...acc, ...pull.reviews]), []) | ||
.filter(removeOwnPulls) | ||
.filter(removeWithEmptyId); | ||
|
||
const approvedReviews = reviews.filter(({ isApproved }) => isApproved); | ||
const observationsList = getProperty(reviews, 'commentsCount'); | ||
const totalObservations = sum(observationsList); | ||
const medianObservations = median(observationsList); | ||
const totalApprovedReviews = approvedReviews.length || 0; | ||
const additions = sum(getProperty(pulls, 'additions')); | ||
const deletions = sum(getProperty(pulls, 'deletions')); | ||
const lines = additions + deletions; | ||
|
||
return { | ||
openedPullRequests, | ||
totalObservations, | ||
medianObservations, | ||
revisionSuccessRate: divide(totalApprovedReviews, reviews.length), | ||
additions, | ||
deletions, | ||
lines, | ||
}; | ||
}; | ||
|
||
|
@@ -43065,10 +43141,7 @@ module.exports = (pulls) => { | |
|
||
if (!acc[userId]) acc[userId] = { userId, pullRequests: [] }; | ||
|
||
acc[userId].pullRequests.push({ | ||
id: pull.id, | ||
submittedAt: pull.submittedAt, | ||
}); | ||
acc[userId].pullRequests.push(pull); | ||
return acc; | ||
}, {}); | ||
|
||
|
@@ -43142,20 +43215,28 @@ module.exports = ({ | |
/***/ 4271: | ||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { | ||
|
||
const { sum, median, divide } = __nccwpck_require__(5494); | ||
const { sum, median } = __nccwpck_require__(5494); | ||
|
||
const getProperty = (list, prop) => list.map((el) => el[prop]); | ||
|
||
module.exports = (reviews) => { | ||
const pullRequestIds = getProperty(reviews, 'pullRequestId'); | ||
const totalReviews = new Set(pullRequestIds).size; | ||
const totalComments = sum(getProperty(reviews, 'commentsCount')); | ||
module.exports = (reviews, pullsById) => { | ||
const pullRequestIds = new Set(getProperty(reviews, 'pullRequestId')); | ||
const totalReviews = pullRequestIds.size; | ||
const commentsCountList = getProperty(reviews, 'commentsCount'); | ||
const totalComments = sum(commentsCountList); | ||
const pullRequests = [...pullRequestIds].map((id) => pullsById[id]); | ||
const reviewedAdditions = sum(getProperty(pullRequests, 'additions')); | ||
const reviewedDeletions = sum(getProperty(pullRequests, 'deletions')); | ||
const reviewedLines = reviewedAdditions + reviewedDeletions; | ||
|
||
return { | ||
totalReviews, | ||
totalComments, | ||
commentsPerReview: divide(totalComments, totalReviews), | ||
timeToReview: median(getProperty(reviews, 'timeToReview')), | ||
commentsPerReview: median(commentsCountList), | ||
reviewedAdditions, | ||
reviewedDeletions, | ||
reviewedLines, | ||
}; | ||
}; | ||
|
||
|
@@ -43200,11 +43281,15 @@ module.exports = (pulls) => { | |
const calculateReviewsStats = __nccwpck_require__(4271); | ||
const groupReviews = __nccwpck_require__(7308); | ||
|
||
module.exports = (pulls) => groupReviews(pulls) | ||
.map(({ userId, reviews }) => { | ||
const stats = calculateReviewsStats(reviews); | ||
return { userId, reviews, stats }; | ||
}); | ||
module.exports = (pulls) => { | ||
const pullsById = pulls.reduce((acc, pull) => ({ ...acc, [pull.id]: pull }), {}); | ||
|
||
return groupReviews(pulls) | ||
.map(({ userId, reviews }) => { | ||
const stats = calculateReviewsStats(reviews, pullsById); | ||
return { userId, reviews, stats }; | ||
}); | ||
}; | ||
|
||
|
||
/***/ }), | ||
|
@@ -44148,13 +44233,18 @@ const getFilteredReviews = (data) => get(data, 'node.reviews.nodes', []).filter( | |
module.exports = (data = {}) => { | ||
const author = parseUser(get(data, 'node.author')); | ||
const publishedAt = new Date(get(data, 'node.publishedAt')); | ||
const additions = get(data, 'node.additions'); | ||
const deletions = get(data, 'node.deletions'); | ||
const handleReviews = (review) => parseReview(review, { publishedAt, authorLogin: author.login }); | ||
|
||
return { | ||
author, | ||
additions, | ||
deletions, | ||
publishedAt, | ||
cursor: data.cursor, | ||
id: get(data, 'node.id'), | ||
lines: additions + deletions, | ||
reviews: getFilteredReviews(data).map(handleReviews), | ||
}; | ||
}; | ||
|
@@ -44168,19 +44258,28 @@ module.exports = (data = {}) => { | |
const get = __nccwpck_require__(615); | ||
const parseUser = __nccwpck_require__(4203); | ||
|
||
const APPROVED = 'APPROVED'; | ||
|
||
module.exports = (data = {}, pullRequest = {}) => { | ||
const author = parseUser(data.author); | ||
const isOwnPull = author.login === pullRequest.authorLogin; | ||
const submittedAt = new Date(data.submittedAt); | ||
const body = get(data, 'body'); | ||
const state = get(data, 'state'); | ||
const commitDate = new Date(get(data, 'commit.pushedDate')); | ||
const startDate = Math.max(pullRequest.publishedAt, commitDate); | ||
const hasBody = !!((body || '').trim()); | ||
const extraComment = hasBody ? 1 : 0; | ||
|
||
return { | ||
author, | ||
isOwnPull, | ||
submittedAt, | ||
body, | ||
id: get(data, 'id'), | ||
commentsCount: get(data, 'comments.totalCount'), | ||
state: get(data, 'state'), | ||
isApproved: state === APPROVED, | ||
commentsCount: get(data, 'comments.totalCount') + extraComment, | ||
timeToReview: submittedAt - startDate, | ||
}; | ||
}; | ||
|
@@ -49526,7 +49625,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"mixpanel","description":"A si | |
/***/ ((module) => { | ||
|
||
"use strict"; | ||
module.exports = /*#__PURE__*/JSON.parse('{"name":"pull-request-stats","version":"3.0.0","description":"Github action to print relevant stats about Pull Request reviewers","main":"dist/index.js","type":"commonjs","scripts":{"build":"eslint src && ncc build src/index.js -o dist -a","test":"jest","lint":"eslint ./"},"keywords":[],"author":"Manuel de la Torre","license":"MIT","jest":{"testEnvironment":"node","testMatch":["**/?(*.)+(spec|test).[jt]s?(x)"]},"dependencies":{"@actions/core":"^1.11.1","@actions/github":"^6.0.0","axios":"^1.7.9","humanize-duration":"^3.32.1","i18n-js":"^3.9.2","jsurl":"^0.1.5","lodash.get":"^4.4.2","markdown-table":"^2.0.0","mixpanel":"^0.18.0"},"devDependencies":{"@eslint/eslintrc":"^3.2.0","@eslint/js":"^9.16.0","@vercel/ncc":"^0.38.3","eslint":"^9.16.0","eslint-config-airbnb-base":"^15.0.0","eslint-plugin-import":"^2.31.0","eslint-plugin-jest":"^28.9.0","globals":"^15.13.0","jest":"^29.7.0"},"funding":"https://github.com/sponsors/manuelmhtr","packageManager":"[email protected]"}'); | ||
module.exports = /*#__PURE__*/JSON.parse('{"name":"pull-request-stats","version":"3.1.0","description":"Github action to print relevant stats about Pull Request reviewers","main":"dist/index.js","type":"commonjs","scripts":{"build":"eslint src && ncc build src/index.js -o dist -a","test":"jest","lint":"eslint ./"},"keywords":[],"author":"Manuel de la Torre","license":"MIT","jest":{"testEnvironment":"node","testMatch":["**/?(*.)+(spec|test).[jt]s?(x)"]},"dependencies":{"@actions/core":"^1.11.1","@actions/github":"^6.0.0","axios":"^1.7.9","humanize-duration":"^3.32.1","i18n-js":"^3.9.2","jsurl":"^0.1.5","lodash.get":"^4.4.2","markdown-table":"^2.0.0","mixpanel":"^0.18.0"},"devDependencies":{"@eslint/eslintrc":"^3.2.0","@eslint/js":"^9.16.0","@vercel/ncc":"^0.38.3","eslint":"^9.16.0","eslint-config-airbnb-base":"^15.0.0","eslint-plugin-import":"^2.31.0","eslint-plugin-jest":"^28.9.0","globals":"^15.13.0","jest":"^29.7.0"},"funding":"https://github.com/sponsors/manuelmhtr","packageManager":"[email protected]"}'); | ||
|
||
/***/ }), | ||
|
||
|
@@ -49550,7 +49649,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"slack":{"logs":{"notConfigured":"Sla | |
/***/ ((module) => { | ||
|
||
"use strict"; | ||
module.exports = /*#__PURE__*/JSON.parse('{"title":"Pull reviewers stats","icon":"https://s3.amazonaws.com/manuelmhtr.assets/flowwer/logo/logo-1024px.png","subtitle":{"one":"Stats of the last day for {{sources}}","other":"Stats of the last {{count}} days for {{sources}}"},"sources":{"separator":", ","fullList":"{{firsts}} and {{last}}","andOthers":"{{firsts}} and {{count}} others"},"columns":{"avatar":"","username":"User","commentsPerReview":"Comments per review","timeToReview":"Time to review","totalReviews":"Total reviews","totalComments":"Total comments","openedPullRequests":"Opened PRs"},"footer":"<sup>⚡️ [Pull request stats](https://bit.ly/pull-request-stats)</sup>"}'); | ||
module.exports = /*#__PURE__*/JSON.parse('{"title":"Pull reviewers stats","icon":"https://s3.amazonaws.com/manuelmhtr.assets/flowwer/logo/logo-1024px.png","subtitle":{"one":"Stats of the last day for {{sources}}","other":"Stats of the last {{count}} days for {{sources}}"},"sources":{"separator":", ","fullList":"{{firsts}} and {{last}}","andOthers":"{{firsts}} and {{count}} others"},"columns":{"avatar":"","username":"User","totalReviews":"Total reviews","totalComments":"Total comments","timeToReview":"Time to review","commentsPerReview":"Comments per review","reviewedAdditions":"Reviewed additions","reviewedDeletions":"Reviewed deletions","reviewedLines":"Reviewed lines","openedPullRequests":"Opened PRs","totalObservations":"Total observations","medianObservations":"Observations per PR","revisionSuccessRate":"Revision success rate","additions":"Additions","deletions":"Deletions","lines":"Lines of code"},"footer":"<sup>⚡️ [Pull request stats](https://bit.ly/pull-request-stats)</sup>"}'); | ||
|
||
/***/ }) | ||
|
||
|
Oops, something went wrong.