A GitHub Action to generate a report that contains member contribution data for a set interval belonging to a GitHub organization.
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: 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 , 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.
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 |
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 |
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.
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.