Skip to content

Implement GitHub user matching feature for committer validation #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Aug 19, 2025

Implements issue #93 by adding two new optional input parameters to validate that commit author name and email match the GitHub user profile.

New Features

author-name-match-github

  • Description: Validates that the committer name matches the authenticated GitHub user's profile name
  • Default: false (disabled by default)
  • Requires: GITHUB_TOKEN environment variable

author-email-match-github

  • Description: Validates that the committer email matches the authenticated GitHub user's profile email(s)
  • Default: false (disabled by default)
  • Requires: GITHUB_TOKEN environment variable

Usage Example

- name: Commit Check
  uses: commit-check/commit-check-action@v1
  with:
    author-name-match-github: true
    author-email-match-github: true
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Implementation Details

The feature adds GitHub API integration to:

  1. Extract committer information from the latest git commit using git log --pretty=format
  2. Compare against the authenticated GitHub user's profile via GitHub API
  3. Check both primary email and verified public emails for email validation
  4. Report validation errors alongside existing commit-check results
  5. Handle edge cases like private emails and API permission issues gracefully

Backward Compatibility

  • Both new parameters default to false, ensuring no breaking changes
  • Existing functionality remains unchanged
  • Only activates when explicitly enabled by users

Error Handling

  • Validates GITHUB_TOKEN is present when features are enabled
  • Gracefully handles API permission issues for private email access
  • Provides clear error messages for validation failures
  • Integrates error reporting with existing result file system

This enhancement helps teams enforce committer identity verification while maintaining the existing commit validation workflow.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copy link
Contributor

github-actions bot commented Aug 19, 2025

Commit-Check ❌

Commit rejected by Commit-Check.                                  
                                                                  
  (c).-.(c)    (c).-.(c)    (c).-.(c)    (c).-.(c)    (c).-.(c)  
   / ._. \      / ._. \      / ._. \      / ._. \      / ._. \   
 __\( C )/__  __\( H )/__  __\( E )/__  __\( C )/__  __\( K )/__ 
(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)
   || E ||      || R ||      || R ||      || O ||      || R ||   
 _.' '-' '._  _.' '-' '._  _.' '-' '._  _.' '-' '._  _.' '-' '._ 
(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)
 `-´     `-´  `-´     `-´  `-´     `-´  `-´     `-´  `-´     `-´ 
                                                                  
Commit rejected.                                                  
                                                                  
Type message check failed => Clean up pycache and update gitignore

 
It doesn't match regex: ^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)|(Merge).*|(fixup!.*)
The commit message should be structured as follows:

 <type>[optional scope]: <description>
 [optional body]
 [optional footer(s)]

 More details please refer to https://www.conventionalcommits.org
Suggest: please check your commit message whether matches above regex

Copilot AI and others added 3 commits August 19, 2025 21:57
Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com>
Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Implement @commit-check/commit-check-action/issues/93 Implement GitHub user matching feature for committer validation Aug 19, 2025
Copilot finished work on behalf of shenxianpeng August 19, 2025 22:05
@Copilot Copilot AI requested a review from shenxianpeng August 19, 2025 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants