Skip to content

Code review: pass the whole process.env to git child process? #32

@josecelano

Description

@josecelano

Imported from: https://github.com/josecelano/library-consumer/issues/15

We are using the SimpleGit package to create git commits.

The git commit command accepts some env vars like:

GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL
GIT_COMMITTER_DATE

SimpleGit also uses a child process to run git and you can pass that child process env vars with:

git.env(process.env);

We are passing the whole process.env.

Wouldn't be better to only pass the variables we know it's going to consume? If we do that we need to modify the code every time we detect a missing env var, and anyway when you use git directly in a workflow git is going to have access to all the env vars.

On the other hand, some things could work just because we have a needed env var and we do not know it. Maybe we can pass the whole env on PRODUCTION and only the consumed vars in TESTS.

Notice that I've removed the commit author env vars because we are planning to overwrite the author with the action name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions