GithubHelp home page GithubHelp logo

project-stats's Introduction

project-stats

A hacky simple script that pulls the history of PR's to a github repo and stores the json in a local file for analysis. This was used to quickly create a means to capture historical stats by quarter and is quite basic.

scrape-pulls.sh

A bash script that uses your github auth token to scrape all pages of results from the github API for your repo. Set GITHUB_API_TOKEN to your API token in quotes, also set GITHUB_ORG_REPO to the string representing the org/repo (like "ebeer/project-stats"). Output is stored in scrape-pulls.out in the same directory as the script.

You can then run analysis from the output file like the following using jq.

Pull Requests by user during a time period

jq --arg s '2021-02-01' --arg e '2021-04-31' 'map(select(.closed_at | . >= $s and . <= $e + "z")) | group_by(.user.login) | map({"user": .[0].user.login, "total":length})' scrape-pulls.out

Pull Request open to close time (average in days) during time period

jq  --arg s '2021-02-01' --arg e '2021-04-31'  'def duration($finish; $start): def twodigits: "00" + tostring | .[-2:]; [$finish, $start] | map(fromdate) | .[0] - .[1] ; map(select(.closed_at | . >= $s and . <= $e + "z")) | map( {time: duration(.closed_at;.created_at)}) |  { avgdays: (([.[].time] | add) / ([.[].time] | length) / 86400)}' scrape-pulls.out

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.