peter-murray / inactive-users-action

GitHub Action for generating a report on user activity in a GitHub Enterprise Organization.
MIT License
70 stars 32 forks source link

inactive-users-action

A GitHub Action that can be run against a GitHub Organization to generate a report on user activity for a given time period. This can be useful in detecting inactive users so that licenses can be reclaimed.

Processing

This action will perform a lot of API requests against your organization to generate the necessary data for identifying user activity. To be compliant with GitHub best practices, this action will perform these API calls sequentially to avoid triggering anti-abuse restrictions on the user/bot account owner of the token.

As a guide, in testing this action takes about 15 minutes to run on an organization which contains ~410 repositories.

Parameters

Outputs

The GitHub Action will register the following outputs that can be referenced in other steps:

Examples

Invoke the action step providing the required parameters to analyze user activity over the last 30 days:

name: Analyze User Activity
id: analyze_user_activity
uses: peter-murray/inactive-users-action@v1
with:
  token: ${{ secrets.ORGANIZATION_AND_REPO_ACCESS_TOKEN }}
  organization: octodemo

Get user activity in the last 90 days for an organization and save the output CSV file as a build artifact:

- name: Analyze User Activity
  id: analyze_user_activity
  uses: peter-murray/inactive-users-action@v1
  with:
    token: ${{ secrets.ORGANIZATION_AND_REPO_ACCESS_TOKEN }}
    organization: octodemo
    activity_days: 90

- name: Save User Activity Report
  uses: actions/upload-artifact@v2
  with:
    name: reports
    path: |
      ${{ steps.analyze_user_activity.outputs.report_csv }}