Skip to content

Commit

Permalink
add list of personal repositories that non-owners are pushing to
Browse files Browse the repository at this point in the history
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
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/_data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
url: "/housekeeping-git-requests"
- title: "API Requests"
url: "/housekeeping-api-requests"
- title: "Repository Location"
url: "/housekeeping-repo-personal-non-owner-push"
- title: "Forks"
url: "/housekeeping-forks"
- title: "Recommendations"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
repository
alice/something
bob/else
4 changes: 4 additions & 0 deletions docs/demo-data/repositories-personal-non-owner-push.tsv
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
24 changes: 24 additions & 0 deletions docs/housekeeping-repo-personal-non-owner-push.html
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>
38 changes: 38 additions & 0 deletions updater/reports/ReportReposPersonalNonOwnerPush.py
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
2 changes: 2 additions & 0 deletions updater/update-stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from reports.ReportPRUsage import *
from reports.ReportRepoActivity import *
from reports.ReportRepositoryHistory import *
from reports.ReportReposPersonalNonOwnerPush import *
from reports.ReportTeamsTotal import *
from reports.ReportTokenlessAuth import *
from reports.ReportUsers import *
Expand Down Expand Up @@ -93,6 +94,7 @@ def main():
ReportPRUsage(configuration, dataDirectory, metaStats).update()
ReportRepoActivity(configuration, dataDirectory, metaStats).update()
ReportRepositoryHistory(configuration, dataDirectory, metaStats).update()
ReportReposPersonalNonOwnerPush(configuration, dataDirectory, metaStats).update()
ReportTeamsTotal(configuration, dataDirectory, metaStats).update()
ReportTokenlessAuth(configuration, dataDirectory, metaStats).update()
ReportUsers(configuration, dataDirectory, metaStats).update()
Expand Down

0 comments on commit 6f4a2cd

Please sign in to comment.