Giter Club home page Giter Club logo

github-org-git-audit-log-for-repos-action's Introduction

GitHub Organization Git Audit Log for Repos Report Action

A GitHub Action to generate a report that contains the total amount of Git clones, pushes and fetches per repository 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 Repos 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-repos-report:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Get Git Audit Log for Repos
        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

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 [email protected] false

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

Workflow dispatch inputs

The additional option to retrieve Git audit log events 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 owned repository.

Column Description
Repository Repository part of a requested organization
Git clones Sum of Git clones for a set interval per repository
Git pushes Sum of Git pushes for a set interval per repository
Git fetches Sum of Git fetches for a set interval per repository

A CSV report file be saved in the repository reports folder using the following naming format: organization-date-interval.csv.

github-org-git-audit-log-for-repos-action's People

Contributors

nicklegan avatar

Forkers

jhaadmins

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.