fix: set safe directory (#1304)

* fix: set safe directory

* fix: naming

* fix: update tests

* fix: dont even check

* fix: add set safe directory

* fix: write test for setSafeDirectory
This commit is contained in:
Tom Hu
2024-02-26 11:31:39 -08:00
committed by GitHub
parent 0cfda1dd0a
commit 2fc4847d3f
9 changed files with 162 additions and 20 deletions

View File

@@ -1,10 +1,13 @@
import * as exec from '@actions/exec';
import {
PLATFORMS,
getBaseUrl,
getCommand,
getPlatform,
isValidPlatform,
isWindows,
PLATFORMS,
getCommand,
setSafeDirectory,
} from './helpers';
let OLDOS = process.env.RUNNER_OS;
@@ -78,3 +81,16 @@ test('getCommand', () => {
expect(getCommand('path', ['-v', '-x'], 'do-upload'))
.toEqual(['path', '-v', '-x', 'do-upload']);
});
test('setSafeDirectory', async () => {
process.env.GITHUB_WORKSPACE = 'testOrg/testRepo';
await setSafeDirectory();
const testSafeDirectory = ([
'git',
'config',
'--get',
'safe.directory',
]).join(' ');
const safeDirectory = await exec.getExecOutput(testSafeDirectory);
expect(safeDirectory.stdout).toBe('testOrg/testRepo\n');
});