Code Monkey home page Code Monkey logo

github-enterprise-user-commit-history's Introduction

User commit history report for GitHub Enterprise

This Node script can be used on GitHub Enterprise (Server or Cloud) to get a specific user's commit history to the default branch for all repositories the user has committed to. It will return a .csv file of the report, including both user and organization-owned repositories. It requires a GitHub Personal Access Token with the following scopes on a user or service account that is an organization owner for every organization in the Enterprise:

  • admin:enterprise
  • admin:org
  • admin:repo

How to run

  • Install the node modules
    • npm install
  • Create .env with needed variables based on .env.example
    • The OUTPUT_FOLDER specified will be created if needed, and the generated .csv will be within
  • Run the script and pass the username via the --user flag
    • node user-commit-history-report.js --user <someUserHandle>

Bulk run reports

  • Create .env with needed variables based on .env.example
  • Use the bash script pull_users.sh to batch run multiple users and combine the results into a single file
    • ./pull_users.sh [username] [username] .. [username]
    • The combined final report will be in the CWD called report.csv

Report layout

Once the script has run to completion, you will be presented with a report in the format below:

Filename: user-<username>-commit-history-report-<epoch_timestamp>.csv

Organization,Repository,Date,CommitSha,CommitMessage,NumFilesChanged,DiffURL
org1,repo1,2022-07-25T09:30:21Z,0884ba29abcdefghijklmnopqrst12345,add stuff,3,https://<url>
org1,repo2,2022-07-22T13:27:00Z,0884ba29abcdefghijklmnopqrst67890,remove things,13,https://<url>
org2,repo1,2022-07-19T06:23:37Z,0884ba29abcdefghijklmnopqrst13579,doing more things,24,https://<url>
org2,repo2,2022-07-19T06:15:01Z,0884ba29abcdefghijklmnopqrst246810,another message,1,https://<url>
...

Caveats

This script requires that the GITHUB_TOKEN provided have the scopes listed above, and the user creating the token needs to be an organization owner of every organization in the Enterprise to get a complete report.

  • If the user creating the GITHUB_TOKEN does not have organization owner access to a specific organization, the end report will not include that organization

The script only returns commits made to the default branch of a repository (i.e. main or master, any commits made to other branches on the repository will not be reflected unless they were merged into the default branch).

github-enterprise-user-commit-history's People

Contributors

iamhughes avatar riot-tfort avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.