diff --git a/github/resource_github_repository_file.go b/github/resource_github_repository_file.go index d83e499371..d16d39a74e 100644 --- a/github/resource_github_repository_file.go +++ b/github/resource_github_repository_file.go @@ -84,14 +84,14 @@ func resourceGithubRepositoryFile() *schema.Resource { "commit_author": { Type: schema.TypeString, Optional: true, - Computed: true, - Description: "The commit author name, defaults to the authenticated user's name", + Computed: false, + Description: "The commit author name, defaults to the authenticated user's name. GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. ", }, "commit_email": { Type: schema.TypeString, Optional: true, - Computed: true, - Description: "The commit author email address, defaults to the authenticated user's email address", + Computed: false, + Description: "The commit author email address, defaults to the authenticated user's email address. GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App.", }, "sha": { Type: schema.TypeString, @@ -255,8 +255,14 @@ func resourceGithubRepositoryFileRead(d *schema.ResourceData, meta interface{}) } d.Set("commit_sha", commit.GetSHA()) - d.Set("commit_author", commit.Commit.GetCommitter().GetName()) - d.Set("commit_email", commit.Commit.GetCommitter().GetEmail()) + + commit_author := commit.Commit.GetCommitter().GetName() + commit_email := commit.Commit.GetCommitter().GetEmail() + + if commit_author != "GitHub" && commit_email != "noreply@github.com" { + d.Set("commit_author", commit_author) + d.Set("commit_email", commit_email) + } d.Set("commit_message", commit.GetCommit().GetMessage()) return nil diff --git a/website/docs/r/repository_file.html.markdown b/website/docs/r/repository_file.html.markdown index 2a809ae57a..fa745d8ed6 100644 --- a/website/docs/r/repository_file.html.markdown +++ b/website/docs/r/repository_file.html.markdown @@ -47,9 +47,9 @@ The following arguments are supported: * `branch` - (Optional) Git branch (defaults to `main`). The branch must already exist, it will not be created if it does not already exist. -* `commit_author` - (Optional) Committer author name to use. +* `commit_author` - (Optional) Committer author name to use. **NOTE:** GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. This maybe useful when a branch protection rule requires signed commits. -* `commit_email` - (Optional) Committer email address to use. +* `commit_email` - (Optional) Committer email address to use. **NOTE:** GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. This may be useful when a branch protection rule requires signed commits. * `commit_message` - (Optional) Commit message when adding or updating the managed file.