Skip to content

Commit a772d06

Browse files
committed
💚 fix: .git dir ownership error in build workflow
1 parent eb54672 commit a772d06

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

util/get-catchup-authors.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ const { execFileSync } = require("child_process");
33
const CO_AUTHOR_PREFIX = "Co-authored-by:";
44
const SKIP_EMAIL = "skip";
55

6+
// bypass git ownership checks
7+
// https://stackoverflow.com/a/73488472
8+
const GIT_BYPASS_OWNERSHIP_CHECK_ARGS = ["-c", "safe.directory='*'"];
9+
610
function main() {
711
const args = process.argv.slice(2);
812

@@ -19,6 +23,7 @@ function main() {
1923
"git",
2024
[
2125
"log",
26+
...GIT_BYPASS_OWNERSHIP_CHECK_ARGS,
2227
"-z", // separate entries with null instead of newline
2328
// author name, author email, commit message
2429
"--format=%an%x00%ae%x00%B%x00",
@@ -46,10 +51,14 @@ function main() {
4651
}
4752

4853
// remap entries with git mailmap
49-
const remappedAuthors = execFileSync("git", ["check-mailmap", "--stdin"], {
50-
input: Array.from(authorSet).join("\n"),
51-
encoding: "utf8"
52-
});
54+
const remappedAuthors = execFileSync(
55+
"git",
56+
[...GIT_BYPASS_OWNERSHIP_CHECK_ARGS, "check-mailmap", "--stdin"],
57+
{
58+
input: Array.from(authorSet).join("\n"),
59+
encoding: "utf8"
60+
}
61+
);
5362

5463
const authorEntrySet = new Set();
5564
for (let authorLine of remappedAuthors.split("\n")) {

0 commit comments

Comments
 (0)