Skip to content

Commit 9a2c4d5

Browse files
committed
📦 new: add errors util function
1 parent 047fc65 commit 9a2c4d5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

source/utils/errors.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { execa } from "execa"
2+
3+
const isCommitterSet = async () => {
4+
try {
5+
const { stdout: name } = await execa("git", ["config", "--get", "user.name"]);
6+
const { stdout: email } = await execa("git", ["config", "--get", "user.email"]);
7+
8+
if (name && email) {
9+
return true;
10+
}
11+
} catch (error) {
12+
console.error("Failed to check if committer is set:", error);
13+
return false;
14+
}
15+
}
16+
17+
export default isCommitterSet;

0 commit comments

Comments
 (0)