Giter Club home page Giter Club logo

github-org-member-contribution-action's Introduction

GitHub Organization Member Contribution Report Action

A GitHub Action to generate a report that contains member contribution data for a set interval belonging to a GitHub organization.

Usage

By default the example workflow below runs on a monthly schedule using the amount of days from today interval as set in action.yml (default 30 days) and can also be triggered manually using a workflow_dispatch event.

name: Member Contribution Report

on:
  schedule:
    # Runs on the first day of the month at 00:00 UTC
    #
    #        ┌────────────── minute
    #        │ ┌──────────── hour
    #        │ │ ┌────────── day (month)
    #        │ │ │ ┌──────── month
    #        │ │ │ │ ┌────── day (week)
    - cron: '0 0 1 * *'
  workflow_dispatch:
    inputs:
      fromdate:
        description: 'Optional interval start date (format: yyyy-mm-dd)'
        required: false # Skipped if workflow dispatch input is not provided
      todate:
        description: 'Optional interval end date (format: yyyy-mm-dd)'
        required: false # Skipped if workflow dispatch input is not provided

jobs:
  member-contribution-report:
    runs-on: ubuntu-latest

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

      - name: Get Member Contributions
        uses: nadeemyaseen-rs/[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:org, read:user 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.

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 30 false
sort Column used to sort the acquired contribution data commitContrib activeContrib, commitContrib, issueContrib, prContrib, prreviewContrib, repoIssueContrib, repoCommitContrib, repoPullRequestContrib repoPullRequestReviewContrib 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

Workflow dispatch inputs

The additional option to retrieve historical contribution data 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 A date matching the format yyyy-mm-dd false
Optional interval end date A date matching the format yyyy-mm-dd false

CSV layout

The results of all except the first two columns will be the sum of contributions for the requested interval per organization member.

Column Description
Member Username of the organization member
Has active contributions Returns true if the member made contributions
Commits created Number of commits created by the org member
Issues opened Number of issues opened by the org member
PRs opened Number of pull requests opened by the org member
PR reviews Number of pull request reviews given by the org member
Issue spread Number of repos the org member opened issues in
Commit spread Number of repos the org member created commits in
PR spread Number of repos the org member opened pull requests in
PR review spread Number of repos the org member reviewed pull request reviews in

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

💡 If no contribution data for an org member is returned but Has active contributions returns true, the user was added to the organization during the requested interval which also counts as a contribution.

GitHub App authentication

In some scenarios it might be preferred to authenthicate as a GitHub App rather than using a personal access token.

The following features could be a benefit authenticating as a GitHub App installation:

  • The GitHub App is directly installed on the organization, no separate user account is required.
  • A GitHub App has more granular permissions than a personal access token.
  • To avoid hitting the 5000 requests per hour GitHub API rate limit, authenticating as a GitHub App installation would increase the API request limit.

The GitHub App authentication strategy can be integrated with the Octokit library by installing and configuring the @octokit/auth-app npm module before rebuilding the Action in a separate repository.

github-org-member-contribution-action's People

Contributors

nadeemyaseen-rs avatar nicklegan avatar dependabot[bot] avatar xrdavies avatar

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.