-
Notifications
You must be signed in to change notification settings - Fork 341
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
Showing
8 changed files
with
133 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"cacheHours": 1, | ||
"params": [ | ||
{ | ||
"name": "repoId", | ||
"replaces": "${repoId}", | ||
"pattern": "^[1-9]\\d*$" | ||
}, | ||
{ | ||
"name": "from", | ||
"replaces": "${from}", | ||
"pattern": "^\\d{4}-\\d{2}-\\d{2}$", | ||
"default": "2000-01-01" | ||
}, | ||
{ | ||
"name": "to", | ||
"replaces": "${to}", | ||
"pattern": "^\\d{4}-\\d{2}-\\d{2}$", | ||
"default": "2099-12-31" | ||
} | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SELECT | ||
DATE_FORMAT(created_at, '%Y-%m-01') AS event_month, | ||
COUNT(*) AS events | ||
FROM github_events | ||
WHERE | ||
repo_id = ${repoId} | ||
AND created_at >= '${from}' | ||
AND created_at < '${to}' | ||
GROUP BY event_month | ||
ORDER BY event_month | ||
; |
10 changes: 10 additions & 0 deletions
10
configs/queries/analyze-recent-collaborative-productivity-metrics/params.json
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"cacheHours": 1, | ||
"params": [ | ||
{ | ||
"name": "repoId", | ||
"replaces": "41986369", | ||
"pattern": "^[1-9]\\d*$" | ||
} | ||
] | ||
} |
71 changes: 71 additions & 0 deletions
71
configs/queries/analyze-recent-collaborative-productivity-metrics/template.sql
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
WITH opened_prs AS ( | ||
SELECT | ||
COUNT(*) AS prs | ||
FROM | ||
github_events ge | ||
WHERE | ||
repo_id = 41986369 | ||
AND type = 'PullRequestEvent' | ||
AND action = 'opened' | ||
AND ge.created_at > DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY) | ||
), merged_prs AS ( | ||
SELECT | ||
COUNT(*) AS prs | ||
FROM | ||
github_events ge | ||
WHERE | ||
repo_id = 41986369 | ||
AND type = 'PullRequestEvent' | ||
AND action = 'closed' | ||
AND pr_merged = true | ||
-- PR was merged in the last 28 days. | ||
AND ge.created_at > DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY) | ||
-- PR was created in the last 28 days. | ||
AND ge.pr_or_issue_created_at > DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY) | ||
), opened_issues AS ( | ||
SELECT | ||
COUNT(*) AS issues | ||
FROM | ||
github_events ge | ||
WHERE | ||
repo_id = 41986369 | ||
AND type = 'IssuesEvent' | ||
AND action = 'opened' | ||
AND ge.created_at > DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY) | ||
), closed_issues AS ( | ||
SELECT | ||
COUNT(*) AS issues | ||
FROM | ||
github_events ge | ||
WHERE | ||
repo_id = 41986369 | ||
AND type = 'IssuesEvent' | ||
AND action = 'closed' | ||
-- Issue was closed in the last 28 days. | ||
AND ge.created_at > DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY) | ||
-- Issue was opened in the last 28 days. | ||
AND ge.pr_or_issue_created_at > DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY) | ||
), reviewed_prs AS ( | ||
SELECT | ||
COUNT(DISTINCT number) AS prs | ||
FROM | ||
github_events ge | ||
WHERE | ||
repo_id = 41986369 | ||
AND type = 'PullRequestReviewEvent' | ||
AND action = 'created' | ||
-- PR was reviewed in the last 28 days. | ||
AND ge.created_at > DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY) | ||
-- PR was created in the last 28 days. | ||
AND ge.pr_or_issue_created_at > DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY) | ||
) | ||
SELECT | ||
mp.prs / op.prs * 100 AS pr_merged_ratio, | ||
rp.prs / op.prs * 100 AS pr_reviewed_ratio, | ||
ci.issues / oi.issues * 100 AS issue_closed_ratio | ||
FROM | ||
opened_prs op, | ||
merged_prs mp, | ||
reviewed_prs rp, | ||
opened_issues oi, | ||
closed_issues ci |
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
64 changes: 13 additions & 51 deletions
64
configs/queries/analyze-recent-top-contributors/template.sql
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 |
---|---|---|
@@ -1,62 +1,24 @@ | ||
WITH prs AS ( | ||
WITH contributions AS ( | ||
SELECT | ||
actor_login, COUNT(*) AS events | ||
FROM | ||
github_events ge | ||
WHERE | ||
repo_id = 41986369 | ||
AND type = 'PullRequestEvent' | ||
AND action = 'opened' | ||
AND ge.created_at > DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY) | ||
AND actor_login NOT LIKE '%bot' AND actor_login NOT LIKE '%[bot]' AND actor_login NOT IN (SELECT login FROM blacklist_users bu) | ||
GROUP BY actor_login | ||
), issues AS ( | ||
SELECT | ||
actor_login, COUNT(*) AS events | ||
FROM | ||
github_events ge | ||
WHERE | ||
repo_id = 41986369 | ||
AND type = 'IssuesEvent' | ||
AND action = 'opened' | ||
AND ge.created_at > DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY) | ||
AND actor_login NOT LIKE '%bot' AND actor_login NOT LIKE '%[bot]' AND actor_login NOT IN (SELECT login FROM blacklist_users bu) | ||
GROUP BY actor_login | ||
), reviews AS ( | ||
SELECT | ||
actor_login, COUNT(*) AS events | ||
FROM | ||
github_events ge | ||
WHERE | ||
repo_id = 41986369 | ||
AND type = 'PullRequestReviewEvent' | ||
AND action = 'created' | ||
AND ge.created_at > DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY) | ||
AND actor_login NOT LIKE '%bot' AND actor_login NOT LIKE '%[bot]' AND actor_login NOT IN (SELECT login FROM blacklist_users bu) | ||
GROUP BY actor_login | ||
), pushes AS ( | ||
SELECT | ||
actor_login, COUNT(*) AS events | ||
FROM | ||
github_events ge | ||
WHERE | ||
repo_id = 41986369 | ||
AND type = 'PushEvent' | ||
AND action = '' | ||
AND ( | ||
(type = 'PullRequestEvent' AND action = 'opened') OR | ||
(type = 'IssuesEvent' AND action = 'opened') OR | ||
(type = 'IssueCommentEvent' AND action = 'created') OR | ||
(type = 'PullRequestReviewEvent' AND action = 'created') OR | ||
(type = 'PullRequestReviewCommentEvent' AND action = 'created') OR | ||
(type = 'PushEvent' AND action = '') | ||
) | ||
AND ge.created_at > DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY) | ||
AND actor_login NOT LIKE '%bot' AND actor_login NOT LIKE '%[bot]' AND actor_login NOT IN (SELECT login FROM blacklist_users bu) | ||
GROUP BY actor_login | ||
) | ||
SELECT actor_login, SUM(sub.events) AS events | ||
FROM ( | ||
SELECT * FROM prs | ||
UNION | ||
SELECT * FROM issues | ||
UNION | ||
SELECT * FROM reviews | ||
UNION | ||
SELECT * FROM pushes | ||
) sub | ||
SELECT actor_login, c.events AS events | ||
FROM contributions c | ||
GROUP BY actor_login | ||
ORDER BY SUM(sub.events) DESC | ||
LIMIT 5 | ||
ORDER BY c.events DESC | ||
LIMIT 9999999999 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.