Skip to content

git user setup fails unless the workspace root directory is also a git repo. #159

@bicknellr

Description

@bicknellr

The git user setup is run before changing directories for cwd. This causes the action to fail if the root directory is not a git repo, even if the intended directory for the action is not the root.

action/src/index.ts

Lines 17 to 34 in 5766bae

let setupGitUser = core.getBooleanInput("setupGitUser");
if (setupGitUser) {
console.log("setting git user");
await gitUtils.setupUser();
}
console.log("setting GitHub credentials");
await fs.writeFile(
`${process.env.HOME}/.netrc`,
`machine github.com\nlogin github-actions[bot]\npassword ${githubToken}`
);
const inputCwd = core.getInput("cwd");
if (inputCwd) {
console.log("changing directory to the one given as the input");
process.chdir(inputCwd);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions