-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add list of personal repositories that non-owners are pushing to
Find personal repositories that non-owners are pushing to. These kind of repositories should be moved into organizations. Only look at active users (not suspended!) and only look at pushes of the last 4 weeks.
- Loading branch information
Lars Schneider
committed
Jan 26, 2018
1 parent
74fce70
commit 53003ad
Showing
5 changed files
with
48 additions
and
0 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
3 changes: 3 additions & 0 deletions
3
docs/demo-data/repositories-personal-non-owner-push-detailed.tsv
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,3 @@ | ||
repository | ||
alice/something | ||
bob/else |
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,4 @@ | ||
date personal repositories with non-owner pushes | ||
2018-01-25 98 | ||
2018-01-24 108 | ||
2018-01-23 110 |
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,37 @@ | ||
from .ReportDaily import * | ||
|
||
# Find personal repositories that non-owners are pushing to. | ||
# These kind of repositories should be moved into organizations. | ||
# Only look at active users (not suspended!) and only look at pushes | ||
# of the last 4 weeks. | ||
class ReportReposPersonalNonOwnerPush(ReportDaily): | ||
def name(self): | ||
return "repositories-personal-non-owner-push" | ||
|
||
def updateDailyData(self): | ||
self.detailedHeader, self.detailedData = self.parseData(self.executeQuery(self.query())) | ||
if len(self.data) == 0: | ||
self.header = ["date", "personal repositories with non-owner pushes"] | ||
self.data.append([str(self.yesterday()), len(self.detailedData)]) | ||
self.truncateData(self.timeRangeTotal()) | ||
self.sortDataByDate() | ||
|
||
def query(self): | ||
query = ''' | ||
SELECT | ||
CONCAT(users.login, "/", repositories.name) as "repository" | ||
FROM | ||
repositories | ||
JOIN users ON repositories.owner_id = users.id | ||
JOIN pushes ON pushes.repository_id = repositories.id | ||
WHERE | ||
users.type = "user" | ||
AND users.suspended_at IS NULL | ||
AND pushes.created_at > DATE_SUB(NOW(), INTERVAL 4 WEEK) | ||
AND pushes.pusher_id != users.id | ||
GROUP BY | ||
repositories.id | ||
ORDER BY | ||
1 | ||
''' | ||
return query |
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