Logs statistics for specific commits in CSV form and optionally sends them as JSON to a web api.
Project description
gitcommitlogger
A Python package that logs the details of a specific set of commits made to a GitHub repository. Logs are saved into a CSV
file and can optionally be sent in a request to a web app, such as a Google Apps Script attached to a Google Sheet where the data can be stored.
GitHub Actions integration
This package is designed to be used in a GitHub Actions workflow, where the workflow is triggered by a push to the repository. Details of the commits included in the push will then be logged.
A sample GitHub Actions workflow is included in .github/workflows/
log-commits.yml
. This example stores the logs into a Google Sheet by first posting them as JSON
data to a web app attached to the Google Sheet. The URL of the web app is presumed be stored in a GitHub Actions Secret named WEB_APP_URL
.
Google Apps Scripts integration
In order to save the logs into a Google Sheet, the following steps are required:
- Create a Google Sheet.
- Attach an Apps Script to the sheet by clicking the
Extensions
->Apps Scripts
menu option in Google Sheets. - Copy/paste the example Apps Script in
apps-script-example
/code.js
into the Apps Script editor and save. This sets up the script as a web app so it can respond toGET
orPOST
requests. - Click the buton to
Deploy
->New Deployment
in the Apps Scripts editor. Note the web app URL that is generated once deployed. - Add the URL of the Apps Script web app to the GitHub repository as a secret named
WEB_APP_URL
. - The
gitcommitlogger
command in the example GitHub Action will send aPOST
request to the Google Sheet web app whenever a push is made on the repository. - The web app will then add a row to the Google Sheet with the details of the commit, including the commit id, author, number of files changed in the commit, number of lines added and deleted.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for gitcommitlogger-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e1f90b3054219d3ace677853095eca7096a43180bc9ade60cc9e72ad870358a |
|
MD5 | 366af54aa3d7b7554384fc1600e50caa |
|
BLAKE2b-256 | df9b4c62430fbfc60ca04abc5a545055a757d5592ae7de3c237fb3910482d6fd |