GitHub Action to list repository recent commits all or unique authors emails
The "GitHub Recent Commits Authors" action is designed to retrieve the recent commit all or unique authors of a GitHub repository. It provides a convenient way to fetch the email addresses of the authors who have made commits within a specified time frame. This action can be used to analyze the contributors' activity and gather insights about the development progress of a project.
- name: Get Recent Commit Authors
uses: AidarGatin/[email protected]
id: recent-commits-authors
with:
github_repository: OWNER/REPOSITORY # default current repository
github_token: ${{ secrets.GH_TOKEN }} # default ''
github_repository_branch: 'main'
days_before: '7' # default 30
unique: 'true' # default 'true'
output_format: 'list' # default 'json'
The action requires parameters
github_repository
: OWNER/REPOSITORY , default will be current repositorygithub_repository_branch
: Branch(main,master .. prod ) , default will be current HEADgithub_token
: ${{ secrets.GH_TOKEN }} # default ''days_before
: '7' # default 30unique
: true/false # default 'true' sorts out only unique emails if trueoutput_format
: 'json/list/string' # default 'json'json
format returns : ["[email protected]","[email protected]",...]list
format returns : [email protected] [email protected] ...string
format returns : [email protected], [email protected],...
name: Get Recent Commit Authors
on:
push:
branches:
- main
workflow_dispatch:
jobs:
get-commits-author:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Get Recent Commit Authors
uses: AidarGatin/[email protected]
id: recent-commits-authors
with:
github_repository: OWNER/REPOSITORY # default current repository
github_repository_branch: 'main'
github_token: ${{ secrets.GH_TOKEN }} # default ''
days_before: '7' # default 30
unique: 'true' # default 'true'
output_format: 'json' # default 'json'
- name: Print Authors' Emails
run: |
echo "Authors' Emails: ${{ steps.recent-commits-authors.outputs.emails }}"
In the above example, the workflow is triggered whenever a push occurs on the main branch. It contains a job named get-commits-author
that runs on the latest version of Ubuntu. The steps of the job include checking out the repository using the actions/checkout
action and retrieving the recent commit authors using the GitHub action.
The action requires a GitHub token
, which can be provided as a repository secret GH_TOKEN
. The days_before
input specifies start day from todays date so last 7 days of the recent commits are considered,
unique
set to true, so only unique emails will get to output.output_format
input determines the format of the output, set to 'json'.
Finally, the workflow prints the emails of the commit authors by accessing the output of the GitHub action using the ${{ steps.recent-commits-authors.outputs.emails }}
.