Skip to main content

aggregateGithubCommits: Aggregate Github commit count by author and time.

Project description

Aggregate Github commit count by author and time.

Python: 3.7+

License: CC BY-NC-SA 4.0

GitHub Actions codecov

Requirement

  • Python 3.7+

  • Your own GitHub account

Install

pip install git+https://github.com/rocaz/aggregateGithubCommits

Usage

aggregateGithubCommits [-h] -r|–repo REPO [-a|–author AUTHOR] [-s|since SINCE] [-u|until UNTIL] [-p|–period {h,d,m,w}] [-t|–term TERM] [-f|–format {text,json,csv}] [-v]

-h, –help: show this help message and exit

-r REPO, –repo REPO: [Required] GitHub owner and repositry name. ex)‘github/covid-19-repo-data’

-a AUTHOR, –author AUTHOR: GitHub author name, default is all authors. ex)‘github’

-s SINCE, –since SINCE: since date in ISO format. ex) ‘2020-07-12’

-u UNTIL, –until UNTIL: until date in ISO format, default is today. ex)‘2020-07-12’

-p {h,d,m,w}, –period {h,d,m,w}: Aggregating period, default is ‘h’. ‘h’: per hour,‘d’: per day, ‘m’: per month, ‘w’: per day of week

-t TERM, –term TERM: Aggregating term from until, default is ‘3m’. ‘3m’ means ‘3months’, ‘100d’ means ‘100days’

-f {text,json,csv}, –format {text,json,csv}: Output format type, default is ‘text’.

-v, –version: show program’s version number and exit

Example

  1. Specified author. Default term is from now to 3months ago.

python ./aggregateGithubCommits.py -r "github/covid-19-repo-data" -a gregce

Output:

Repository: git://github.com/github/covid-19-repo-data.git
Total:      15
   Author:    gregce
        Hour    00    01    02    03    04    05    06    07    08    09    10    11    12    13    14    15    16    17    18    19    20    21    22    23
       Count       2     1     2     1     1     0     2     0     1     2     0     1     1     1     0     0     0     0     0     0     0     0     0     0
        AuthorTotal:        15
  1. The term is specified from ‘2020-02-29’ to ‘2020-08-02’, Aggregation period is ‘per month’.

python ./aggregateGithubCommits.py -r "github/covid-19-repo-data" -p m -u '2020-08-02' -s '2020-02-29'

Output:

Repository: git://github.com/github/covid-19-repo-data.git
Total:      49
   Author:    gregce
       Month    2020-03  2020-04  2020-05  2020-06  2020-07
       Count          0        5        4        4        7
        AuthorTotal:        20
   Author:    Ashikpaul
       Month    2020-03  2020-04  2020-05  2020-06  2020-07
       Count          0        0        0        0        1
        AuthorTotal:         1
   Author:    hamelsmu
       Month    2020-03  2020-04  2020-05  2020-06  2020-07
       Count          0       22        0        4        0
        AuthorTotal:        26
   Author:    github-actions[bot]
       Month    2020-03  2020-04  2020-05  2020-06  2020-07
       Count          0        1        0        0        0
        AuthorTotal:         1
   Author:    DJedamski
       Month    2020-03  2020-04  2020-05  2020-06  2020-07
       Count          1        0        0        0        0
        AuthorTotal:         1
  1. Output format is setted to JSON.

python ./aggregateGithubCommits.py -r "github/covid-19-repo-data" -f json

{"AggregatedCommits": {"gregce": {"00": 2, "01": 1, "02": 2, "03": 1, "04": 1, "06": 2, "08": 1, "09": 2, "11": 1, "12": 1, "13": 1}, "Ashikpaul": {"00": 0, "01": 0, "02": 1, "03": 0, "04": 0, "06": 0, "08": 0, "09": 0, "11": 0, "12": 0, "13": 0}, "hamelsmu": {"00": 0, "01": 0, "02": 4, "03": 0, "04": 0, "06": 0, "08": 0, "09": 0, "11": 0, "12": 0, "13": 0}}, "Period": "h", "CommitCount": 20, "Authors": ["gregce", "Ashikpaul", "hamelsmu"], "Indexes": ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"]}
  1. Output format is setted to CSV.

python ./aggregateGithubCommits.py -r "github/covid-19-repo-data" -f csv

"","00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"
"gregce","2","1","2","1","1","0","2","0","1","2","0","1","1","1","0","0","0","0","0","0","0","0","0","0"
"Ashikpaul","0","0","1","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"
"hamelsmu","0","0","4","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"

Environment Variable

‘GITHUBTOKEN’

Plase set your Github Token

License

CC BY-NC-SA 4.0

image1

non-commercial use only.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

File details

Details for the file aggregateGithubCommits-3.20200806-py3-none-any.whl.

File metadata

  • Download URL: aggregateGithubCommits-3.20200806-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.6

File hashes

Hashes for aggregateGithubCommits-3.20200806-py3-none-any.whl
Algorithm Hash digest
SHA256 d59988352bf8237d8fe2c61cd3c169f3da2b2d1bf2f9e481f5550d412f090864
MD5 86e0d881c570a7508beb6eb96ea92dd5
BLAKE2b-256 1f5e4bbc041f8dbc6e0d488b3e82d3d8a56754d249f1e6d25bcba3116d52e40b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page