Skip to content

Check Author and Committer

Actions

About

Checks the email address and/or name for the author and/or committer
v1.1.1
Latest
By dguo
Star (1)

Check Author and Committer Action

This action (for GitHub Actions) checks that the email address and/or name for the commit's author and/or committer matches specified regexes. For example, you might want to ensure that committers use their organization email addresses rather than their personal email addresses.

Usage

This example checks that the committer has an email ending in @example.com.

name: Check committer email
on:
  push:
    branches:
      - main
  pull_request:
jobs:
  check-commit-author:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: dguo/check-author-and-committer-action@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          committer-email-regex: '@example\.com$'

This example allows for an @example.com or an @users.noreply.github.com email (for those who keep their personal email address private).

- uses: dguo/check-author-and-committer-action@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    committer-email-regex: '@example\.com$|@users\.noreply\.github\.com$'

Custom Error Message

You can provide a custom-error-message for when a check fails. This can be useful for providing context, such as by linking to documentation that explains what the committer needs to do.

- uses: dguo/check-author-and-committer-action@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    custom-error-message: 'See https://example.com/internal-docs/setting-your-git-config'
    committer-email-regex: '@example\.com$'

All Inputs

- uses: dguo/check-author-and-committer-action@v1
  with:
    # (Required) GitHub token to use for API calls
    github-token: ${{ secrets.GITHUB_TOKEN }}
    # (Optional) Custom error message to provide additional context or information
    custom-error-message: ''
    # (Optional) JavaScript regex to validate the author's email address
    author-email-regex: ''
    # (Optional) JavaScript regex to validate the author's name
    author-name-regex: ''
    # (Optional) JavaScript regex to validate the committer's email address
    committer-email-regex: ''
    # (Optional) JavaScript regex to validate the committer's name
    committer-name-regex: ''

Author vs. Committer

Git does distinguish between the author and committer for a commit. They are frequently the same person, but there are cases where it makes sense for them to be different.

License

MIT

Check Author and Committer is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Checks the email address and/or name for the author and/or committer
v1.1.1
Latest
By dguo

Check Author and Committer is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.