Skip to content

Commit

Permalink
Add workaround for newer git versions
Browse files Browse the repository at this point in the history
  • Loading branch information
sbergen committed May 25, 2024
1 parent 54a09ea commit b868245
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion ResponsibleUnity/Assets/EditorSetup/ContinuousIntegration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,26 @@ public static class ContinuousIntegration
public static async void BuildDocumentation()
{
var returnCode = 0;
string stdout;

try
{
// Mark directory as safe for git if running in GitHub Actions
// See e.g. https://github.com/actions/runner/issues/2033
const string githubWorkspace = "/github/workspace";
if (RepositoryPath == githubWorkspace)
{
(returnCode, stdout) = RunCommand(
workingDir: RepositoryPath,
command: "git",
"config", "--global", "--add", "safe.directory", githubWorkspace);

if (returnCode != 0)
{
Debug.LogError($"Setting git directory as safe failed:\n{stdout}");
}
}

Debug.Log("Updating failure example...");
File.WriteAllText(
Path.Combine(DocFxDir, "failure.md"),
Expand All @@ -39,7 +56,6 @@ public static async void BuildDocumentation()
SyncSolution();

Debug.Log("Building documentation...");
string stdout;
(returnCode, stdout) = RunCommand(
workingDir: DocFxDir,
command: "docfx",
Expand Down

0 comments on commit b868245

Please sign in to comment.