Skip to content
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

feat(git): make gitAuthor repo-configurable #11539

Merged
merged 8 commits into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,14 @@ If configured, Renovate bypasses its normal major/minor/patch upgrade logic and
Beware that Renovate follows tags strictly.
For example, if you are following a tag like `next` and then that stream is released as `stable` and `next` is no longer being updated then that means your dependencies also won't be getting updated.

## gitAuthor

You can customize the Git author that's used whenever Renovate creates a commit.
The `gitAuthor` option accepts a RFC5322-compliant string.

**Note** We strongly recommend that the Git author email you use is unique to Renovate.
Otherwise, if another bot or human shares the same email and pushes to one of Renovate's branches then Renovate will mistake the branch as unmodified and potentially force push over the changes.

## gitIgnoredAuthors

Specify commit authors ignored by Renovate.
Expand Down
8 changes: 0 additions & 8 deletions docs/usage/self-hosted-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,6 @@ This should be set to a Personal Access Token (GitHub only) when `forkMode` is s
Renovate will use this token to fork the repository into the personal space of the person owning the Personal Access Token.
Renovate will then create branches on the fork and opens Pull Requests on the parent repository.

## gitAuthor

You can customize the Git author that's used whenever Renovate creates a commit.
The `gitAuthor` option accepts a RFC5322-compliant string.

**Note** We strongly recommend that the Git author email you use is unique to Renovate.
Otherwise, if another bot or human shares the same email and pushes to one of Renovate's branches then Renovate will mistake the branch as unmodified and potentially force push over the changes.

## gitNoVerify

Controls when Renovate passes the `--no-verify` flag to `git`.
Expand Down
1 change: 0 additions & 1 deletion lib/config/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ const options: RenovateOptions[] = [
name: 'gitAuthor',
description: 'Author to use for Git commits. Must conform to RFC5322.',
type: 'string',
globalOnly: true,
},
{
name: 'gitPrivateKey',
Expand Down
1 change: 1 addition & 0 deletions lib/platform/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export async function initPlatform(config: AllConfig): Promise<AllConfig> {
logger.debug(`Using platform gitAuthor: ${String(platformInfo.gitAuthor)}`);
returnConfig.gitAuthor = platformInfo.gitAuthor;
}
// This is done for validation and will be overridden later once repo config is incorporated
setGitAuthor(returnConfig.gitAuthor);
const platformRule: HostRule = {
hostType: returnConfig.platform,
Expand Down
4 changes: 3 additions & 1 deletion lib/util/git/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,11 @@ export async function writeGitAuthor(): Promise<void> {
export async function setUserRepoConfig({
branchPrefix,
gitIgnoredAuthors,
gitAuthor,
}: RenovateConfig): Promise<void> {
await setBranchPrefix(branchPrefix);
config.ignoredAuthors = gitIgnoredAuthors ?? [];
setGitAuthor(gitAuthor);
}

export async function getSubmodules(): Promise<string[]> {
Expand Down Expand Up @@ -381,7 +383,6 @@ export async function syncGit(): Promise<void> {
}
logger.warn({ err }, 'Cannot retrieve latest commit');
}
await writeGitAuthor();
config.currentBranch = config.currentBranch || (await getDefaultBranch(git));
if (config.branchPrefix) {
await setBranchPrefix(config.branchPrefix);
Expand Down Expand Up @@ -733,6 +734,7 @@ export async function commitFiles({
}
const { localDir } = getGlobalConfig();
await configSigningKey(localDir);
await writeGitAuthor();
try {
await git.reset(ResetMode.HARD);
await git.raw(['clean', '-fd']);
Expand Down