-
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 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 29, 2018
1 parent
74fce70
commit 6f4a2cd
Showing
6 changed files
with
73 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 nonowner 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,24 @@ | ||
--- | ||
layout: default | ||
title: Forks | ||
permalink: /housekeeping-repo-personal-non-owner-push | ||
--- | ||
|
||
<div class="chart-placeholder"> | ||
<h3>Personal Repositories with Nonowner Pushes in the Last 4 Weeks</h3> | ||
<canvas | ||
data-url="{{ site.dataURL }}/repositories-personal-non-owner-push.tsv" | ||
data-type="history" | ||
></canvas> | ||
<div class="info-box"> | ||
<p> | ||
Repositories in user accounts should only be pushed to by their owners as these repositories might become unavailable or deleted if the owner leaves the company. | ||
</p> | ||
<p> Repositories, in which people actively collaborate, should be <a href="https://help.github.com/articles/about-repository-transfers/">transferred</a> to an organization account. | ||
</p> | ||
</div> | ||
</div> | ||
|
||
<div class="chart-placeholder"> | ||
<table data-url="{{ site.dataURL }}/repositories-personal-non-owner-push-detailed.tsv"></table> | ||
</div> |
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,38 @@ | ||
from .ReportDaily import * | ||
|
||
# Find personal repositories that non-owners are pushing to. | ||
# These 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 nonowner pushes"] | ||
self.data.append([str(self.yesterday()), len(self.detailedData)]) | ||
self.truncateData(self.timeRangeTotal()) | ||
self.sortDataByDate() | ||
|
||
def query(self): | ||
fourWeeksAgo = self.daysAgo(28) | ||
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 CAST(pushes.created_at AS DATE) BETWEEN "''' + str(fourWeeksAgo) + '''" AND "''' + str(self.yesterday()) + '''" | ||
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