Skip to content

nicklegan/github-org-git-audit-log-for-members-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Organization Git Audit Log for Members Report Action

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.

Usage

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/github-org-git-audit-log-for-members-action@v1.0.0
        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

GitHub secrets

Name Value Required
ORG_TOKEN A repo, read:orgscoped 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.

Action inputs

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 github-actions@github.com false

💡 The audit log retains Git events for 7 days. This is shorter than other audit log events.

Workflow dispatch inputs

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

CSV layout

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.

About

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.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks