Create a User Activity Report for your Github organization. The action uses the Github GraphQL API and depending on the size of your organization will fetch a lot of data.
If you get an error because you reach the hourly rate limit of 5000 points you can either reduce the report time frame (since-days
or since
and until
) or play with the other inputs. Comments cost a lot of points so you might want to disable them if not needed.
The action only fetches nested information on objects that have updates since since-days
. So the total rate limit cost varies depending on the created/updated objects in the time window. It is printed at the end of the action and can be seen in the workflow logs.
💡 By default only the commits on the default branch are analyzed because usually the activity on other branches ends up in pull requests. You can set analyze-commits-on-all-branches
to true
to count commits on all branches.
name: 'User Activity Report'
on:
workflow_dispatch:
jobs:
'create-report':
runs-on: ubuntu-latest
steps:
- uses: sorekz/user-activity-report@v1
with:
token: ${{ secrets.TOKEN }}
organization: 'your-org'
You can see the report in the action run summary. Users are sorted by Org member, Active, an Activity Score with the most active users are listed on top.
User | Org member | Active | Commits | Created Issues | Issue Comments | Created PRs | Merged PRs | PR Comments | Created Discussions | Discussion Comments |
---|---|---|---|---|---|---|---|---|---|---|
sorekz | ✔️ | ✔️ | 8 | 2 | 2 | 1 | 1 | 1 | 1 | 2 |
daniel | ✔️ | ❌ | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
dependabot | ❌ | ✔️ | 0 | 0 | 0 | 8 | 0 | 0 | 0 | 0 |
You can enable the option to write the report as csv and/or json output and use the actions/upload-artifact action to upload them. The zip file containing both reports can be downloaded afterwards in the action run.
name: 'User Activity Report'
on:
workflow_dispatch:
jobs:
'create-report':
runs-on: ubuntu-latest
steps:
- uses: sorekz/user-activity-report@v1
with:
token: ${{ secrets.TOKEN }}
organization: 'your-org'
create-json: data.json
create-csv: data.csv
- uses: actions/upload-artifact@v3
with:
name: reports
path: |
data.json
data.csv
By passing the since
and until
parameters it's possible to generate monthly reports, or for any other time frames. Be aware that the ISO 8601 value 2023-08
is equal to the first millisecond on 1st August and that the until
parameter is exclusive.
The example creates a report for activities between 2023-07-01T00:00:00.000Z
and 2023-07-31T23:59:59.999Z
name: 'User Activity Report'
on:
workflow_dispatch:
jobs:
'create-report':
runs-on: ubuntu-latest
steps:
- uses: sorekz/user-activity-report@v1
with:
token: ${{ secrets.TOKEN }}
organization: 'your-org'
since: 2023-07
until: 2023-08
By passing the since
and until
parameters in combination with the actions/github-script
action it's possible to generate reports for the previous month. If this workflow is run on 2023-08-05 it will return results equal to since: 2023-07
and until: 2023-08
.
name: 'User Activity Report'
on:
workflow_dispatch:
jobs:
'create-report':
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
id: since-date
with:
script: return new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1)
result-encoding: string
- uses: actions/github-script@v6
id: until-date
with:
script: return new Date(new Date().getFullYear(), new Date().getMonth(), 1)
result-encoding: string
- uses: sorekz/user-activity-report@v1
with:
token: ${{ secrets.TOKEN }}
organization: 'your-org'
since: ${{ steps.since-date.outputs.result }}
until: ${{ steps.until-date.outputs.result }}
Required Github access token for the organization. Required permissions are repo
, read:org
Required The organization to create the report for
The number of days in the past to search for activity for. One day is relative to the start time and equal to 24 hours.
If the parameter since
has a value, this parameter is ignored.
default: 90
The ISO 8601 since date. 2023-12
is equal to 2023-12-01T00:00:00.000Z
The ISO 8601 until date. This value is exclusive. E.g. 2024-01
will include results until 2023-12-31T23:59:59.999Z
.
If the parameter since
has a value and this parameter has no value, it defaults to the current time.
Enable to analyze commits
default: true
Enable to analyze commits on all branches. By default only commits on the default branches are analyzed. Ignored if analyze-commits
is false
default: false
Enable to analyze issues
default: true
Enable to analyze issue comments
default: true
Enable to analyze pull requests
default: true
Enable to analyze pull requests comments
default: true
Enable to analyze discussions
default: true
Enable to analyze discussions comments
default: true
Save the report as json file to this path
Save the report as csv file to this path
Write the report as step summary to the github action
default: true
- Commits are only counted once. If you have
analyze-commits-on-all-branches
enabled then a commit that is part of multiple branches is only counted once. If you use merge commits a new commit with a new git ref is created and counted. - Commits that have been authored but not committed within the report time frame are not counted. The commit date is relevant.
- A merged pull request is counted both in Created PRs and Merged PRs if it was created and merged within the report time frame
The cost is nested so you can multiply each indention and sum it up. It is approximately:
- 1 per 100 organization members
- 1 per 100 repositories
- 1 per 100 branches in each repository
- 1 per 100 commits within the report time frame in each branch
- 1 per 100 issues created/updated
since-days
orsince
in each repository- 1 per 100 issue comments in each issue
- 1 per 100 pull requests in each repository
- 1 per 100 pull request comments in each pull request
- 1 per 100 discussions in each repository
- 1 per 100 discussion comments in each pull request
- 1 per 100 branches in each repository
Because the pull requests and discussions can not be queried based on a timestamp the action always fetches all comments, but filters comments only for the objects that have updates (including added comments) since since-days
or since
.
- Discussions can currently not be analyzed on GHES because the graphQL schema is missing fields compared to the schema on Github.com
This action was inspired by Peter Murray's https://github.com/peter-murray/inactive-users-action