A GitHub Action to generate a report that contains the total amount of Git clones, pushes and fetches per organization member for a set interval.
MIT License
A GitHub Action to generate a report that contains the total amount of Git clones, pushes and fetches per organization member for a set interval.
The example workflow below runs on a weekly schedule and can be executed manually using a workflow_dispatch event.
name: Git Audit Log for Members Report
on:
schedule:
# Runs on every Sunday at 00:00 UTC
#
# ┌────────────── minute
# │ ┌──────────── hour
# │ │ ┌────────── day (month)
# │ │ │ ┌──────── month
# │ │ │ │ ┌────── day (week)
- cron: '0 0 * * 0'
workflow_dispatch:
inputs:
fromdate:
description: 'Optional interval start date within the last 7 days (format: yyyy-mm-dd)'
required: false # Skipped if workflow dispatch input is not provided
todate:
description: 'Optional interval end date within the last 7 days (format: yyyy-mm-dd)'
required: false # Skipped if workflow dispatch input is not provided
jobs:
git-audit-log-for-members-report:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get Git Audit Log for Members
uses: nicklegan/[email protected]
with:
token: ${{ secrets.ORG_TOKEN }}
fromdate: ${{ github.event.inputs.fromdate }} # Used for workflow dispatch input
todate: ${{ github.event.inputs.todate }} # Used for workflow dispatch input
Name | Value | Required |
---|---|---|
ORG_TOKEN |
A repo , read:org scoped Personal Access Token
|
true |
ACTIONS_STEP_DEBUG |
true Enables diagnostic logging
|
false |
💡 Disable token expiration to avoid failed workflow runs when running on a schedule.
Name | Description | Default | Options | Required |
---|---|---|---|---|
org |
Organization different than workflow context | false |
||
days |
Amount of days in the past to collect data for (max 7 days) | 7 |
false |
|
sort |
Column used to sort the acquired audit log data | gitClone |
gitClone , gitPush gitFetch
|
false |
committer-name |
The name of the committer that will appear in the Git history | github-actions |
false |
|
committer-email |
The committer email that will appear in the Git history | [email protected] |
false |
💡 The audit log retains Git events for 7 days. This is shorter than other audit log events.
An additional option to retrieve Git audit log events by using a custom date interval.
If the below fields are left empty during workflow dispatch input, the default interval option of set days from the current date, configured in main.yml
will be used instead.
Name | Value | Required |
---|---|---|
Optional interval start date within the last 7 days |
A date matching the format yyyy-mm-dd
|
false |
Optional interval end date within the last 7 days |
A date matching the format yyyy-mm-dd
|
false |
The results of all except the first column will be the sum of Git audit log events for the requested interval per organization member.
Column | Description |
---|---|
Username | Member part of the requested organization |
Git clones | Sum of Git clones for a set interval per organization member |
Git pushes | Sum of Git pushes for a set interval per organization member |
Git fetches | Sum of Git fetches for a set interval per organization member |
A CSV report file will be saved in the repository reports folder using the following naming format: organization
-date
-interval
.csv.