From d4bc74899dd0dbd9456f7c79482aada140c884c7 Mon Sep 17 00:00:00 2001
From: Kenneth Garza <kennethgarza@gmail.com>
Date: Wed, 3 Feb 2021 11:39:11 -0500
Subject: [PATCH] adding code for public action test

---
 dist/index.js       |  2 +-
 src/fs-helper.ts    | 16 ++++++++++++++++
 src/input-helper.ts |  4 ++--
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/dist/index.js b/dist/index.js
index e765cc2..2be828a 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -14515,7 +14515,7 @@ const path = __importStar(__webpack_require__(622));
 function getInputs() {
     const result = {};
     // GitHub workspace
-    let githubWorkspacePath = process.env['GITHUB_WORKSPACE'];
+    let githubWorkspacePath = fshelper.getWorkingDir();
     if (!githubWorkspacePath) {
         throw new Error('GITHUB_WORKSPACE not defined');
     }
diff --git a/src/fs-helper.ts b/src/fs-helper.ts
index c443404..54e95ce 100644
--- a/src/fs-helper.ts
+++ b/src/fs-helper.ts
@@ -1,4 +1,20 @@
 import * as fs from 'fs'
+import { createCommandManager } from './git-command-manager'
+
+export function getWorkingDir(): string {
+
+    let currentWS = process.env['GITHUB_WORKSPACE']
+
+    // original : {{working dir}}/{{repoName}}/{{repoName}}
+    // new      : {{working dir}}/{{short-repo-name}}
+
+    let repoName = currentWS.split('\\').pop().split('/').pop()
+    let shortenedRepoName = repoName.split('.').pop()
+    let workDir = currentWS.substring(currentWS.indexOf(repoName))
+    let newWS = workDir + shortenedRepoName
+
+    return newWS  
+}
 
 export function directoryExistsSync(path: string, required?: boolean): boolean {
   if (!path) {
diff --git a/src/input-helper.ts b/src/input-helper.ts
index 4c05d6e..2980131 100644
--- a/src/input-helper.ts
+++ b/src/input-helper.ts
@@ -8,12 +8,12 @@ export function getInputs(): IGitSourceSettings {
   const result = ({} as unknown) as IGitSourceSettings
 
   // GitHub workspace
-  let githubWorkspacePath = process.env['GITHUB_WORKSPACE']
+  let githubWorkspacePath = fsHelper.getWorkingDir()
   if (!githubWorkspacePath) {
     throw new Error('GITHUB_WORKSPACE not defined')
   }
   githubWorkspacePath = path.resolve(githubWorkspacePath)
-  core.debug(`GITHUB_WORKSPACE = '${githubWorkspacePath}'`)
+  core.log(`GITHUB_WORKSPACE = '${githubWorkspacePath}'`)
   fsHelper.directoryExistsSync(githubWorkspacePath, true)
 
   // Qualified repository