Add chownFilesTo (#187)

* add chownFilesTo

* added missing newline

* added more chownFilesTo
This commit is contained in:
Skjalg S. Mæhre
2022-06-24 06:59:01 -04:00
committed by GitHub
parent e8774f3837
commit 3d5d2f5834
7 changed files with 37 additions and 4 deletions

11
dist/index.js generated vendored
View File

@@ -42,7 +42,7 @@ function run() {
try {
model_1.Action.checkCompatibility();
const { workspace, actionFolder } = model_1.Action;
const { editorVersion, customImage, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, checkName, } = model_1.Input.getFromUser();
const { editorVersion, customImage, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, checkName, chownFilesTo, } = model_1.Input.getFromUser();
const baseImage = new model_1.ImageTag({ editorVersion, customImage });
const runnerTemporaryPath = process.env.RUNNER_TEMP;
try {
@@ -60,6 +60,7 @@ function run() {
gitPrivateToken,
githubToken,
runnerTemporaryPath,
chownFilesTo,
});
}
finally {
@@ -169,7 +170,7 @@ const Docker = {
});
},
getLinuxCommand(image, parameters) {
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, } = parameters;
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, chownFilesTo, } = parameters;
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
if (!(0, fs_1.existsSync)(githubHome))
(0, fs_1.mkdirSync)(githubHome);
@@ -208,6 +209,7 @@ const Docker = {
--env RUNNER_TEMP \
--env RUNNER_WORKSPACE \
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
--env CHOWN_FILES_TO="${chownFilesTo}" \
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
--volume "${githubHome}:/root:z" \
--volume "${githubWorkflow}:/github/workflow:z" \
@@ -222,7 +224,7 @@ const Docker = {
/bin/bash -c /entrypoint.sh`;
},
getWindowsCommand(image, parameters) {
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, } = parameters;
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, chownFilesTo, } = parameters;
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
if (!(0, fs_1.existsSync)(githubHome))
(0, fs_1.mkdirSync)(githubHome);
@@ -261,6 +263,7 @@ const Docker = {
--env RUNNER_TEMP \
--env RUNNER_WORKSPACE \
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
--env CHOWN_FILES_TO="${chownFilesTo}" \
${sshAgent ? '--env SSH_AUTH_SOCK=c:/ssh-agent' : ''} \
--volume "${githubHome}":"c:/root" \
--volume "${githubWorkflow}":"c:/github/workflow" \
@@ -477,6 +480,7 @@ const Input = {
const gitPrivateToken = (0, core_1.getInput)('gitPrivateToken') || '';
const githubToken = (0, core_1.getInput)('githubToken') || '';
const checkName = (0, core_1.getInput)('checkName') || 'Test Results';
const chownFilesTo = (0, core_1.getInput)('chownFilesTo') || '';
// Validate input
if (!this.testModes.includes(testMode)) {
throw new Error(`Invalid testMode ${testMode}`);
@@ -509,6 +513,7 @@ const Input = {
gitPrivateToken,
githubToken,
checkName,
chownFilesTo,
};
},
};

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -114,3 +114,19 @@ for platform in ${TEST_PLATFORMS//;/ }; do
cat "$FULL_ARTIFACTS_PATH/$platform-results.xml" | grep test-run | grep Passed
fi
done
#
# Permissions
#
# Make a given user owner of all artifacts
if [[ -n "$CHOWN_FILES_TO" ]]; then
chown -R "$CHOWN_FILES_TO" "$UNITY_PROJECT_PATH"
chown -R "$CHOWN_FILES_TO" "$FULL_ARTIFACTS_PATH"
chown -R "$CHOWN_FILES_TO" "$FULL_COVERAGE_RESULTS_PATH"
fi
# Add read permissions for everyone to all artifacts
chmod -R a+r "$UNITY_PROJECT_PATH"
chmod -R a+r "$FULL_ARTIFACTS_PATH"
chmod -R a+r "$FULL_COVERAGE_RESULTS_PATH"