Use OS specific temp folder for test repos

This commit is contained in:
Paul Hatcherian 2020-10-06 20:45:54 -04:00
parent 800ea493f7
commit bcb0692ebb

View file

@ -1,6 +1,7 @@
const cp = require('child_process'); const cp = require('child_process');
const path = require('path'); const path = require('path');
const process = require('process'); const process = require('process');
const os = require('os');
// Action input variables // Action input variables
const defaultInputs = { const defaultInputs = {
@ -13,7 +14,7 @@ const defaultInputs = {
// Creates a randomly named git repository and returns a function to execute commands in it // Creates a randomly named git repository and returns a function to execute commands in it
const createTestRepo = (inputs) => { const createTestRepo = (inputs) => {
const repoDirectory = `/tmp/test${Math.random().toString(36).substring(2, 15)}`; const repoDirectory = path.join(os.tmpdir(), `test${Math.random().toString(36).substring(2, 15)}`);
cp.execSync(`mkdir ${repoDirectory}`); cp.execSync(`mkdir ${repoDirectory}`);
cp.execSync(`git init ${repoDirectory}`); cp.execSync(`git init ${repoDirectory}`);