-
Notifications
You must be signed in to change notification settings - Fork 775
Description
The GitHub REST API for creating, updating, and deleting file contents supports optional author and committer parameters that allow callers to specify a different author or committer than the authenticated user:
PUT /repos/{owner}/{repo}/contents/{path}(create/update)DELETE /repos/{owner}/{repo}/contents/{path}(delete)
Both parameters are JSON objects with name (required), email (required), and date (optional) fields. When provided, the resulting Git commit records the specified person as the author or committer, enabling the standard Git distinction between "author" (who wrote the change) and "committer" (who applied it). GitHub's UI renders this as "UserX authored and ServiceAccount committed".
API reference: https://docs.github.com/en/rest/repos/contents#create-or-update-file-contents
Current behavior
GHContentBuilder(used viaGHRepository.createContent()) does not expose methods to setauthororcommitter.GHContent.update()andGHContent.delete()build their requests without support for these parameters.
Requested changes
-
Add
author(String name, String email)andcommitter(String name, String email)methods toGHContentBuilder, with optional overloads accepting anInstant dateparameter. -
Add builder-style APIs for update and delete (
GHContentUpdaterandGHContentDeleter, accessible viaGHContent.createUpdate()andGHContent.createDelete()) that supportauthor,committer,branch,content, andmessageconfiguration.
Use case
Applications that use a single service account (PAT or GitHub App) to manage files in a repository on behalf of multiple end-users need to attribute each commit to the specific end-user who initiated the action, while the service account remains the committer. The GitHub REST API supports this natively, but the library does not currently expose it.