Skip to content

Commit

Permalink
fix(cli): add git author
Browse files Browse the repository at this point in the history
  • Loading branch information
juanrgm committed Apr 3, 2024
1 parent f7e4ec3 commit 1ecda25
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
5 changes: 4 additions & 1 deletion packages/cli/src/repositories/GitRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,10 @@ export class GitRepository extends RepositoryAbstract<GitRepositoryConfig> {
size: size.toString(),
});

await git.addTag(meta.name, meta.message);
await git.addTag(meta.name, meta.message, {
userName: "datatruck",
userEmail: "datatruck@localhost",
});
await git.push({ branchName });
await git.pushTags();

Expand Down
18 changes: 15 additions & 3 deletions packages/cli/src/utils/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,23 @@ export class Git {
);
}

async addTag(name: string, message?: string) {
async addTag(
name: string,
message?: string,
options: {
allowEmpty?: boolean;
userName?: string;
userEmail?: string;
} = {},
) {
const commit = [
...(options.userName ? ["-c", `user.name='${options.userName}'`] : []),
...(options.userEmail ? ["-c", `user.email='${options.userEmail}'`] : []),
];
if (message) {
await this.exec(["tag", "-a", name, "-m", message]);
await this.exec([...commit, "tag", "-a", name, "-m", message]);
} else {
await this.exec(["tag", name]);
await this.exec([...commit, "tag", name]);
}
}

Expand Down

0 comments on commit 1ecda25

Please sign in to comment.