1
0
Fork 0
mirror of https://github.com/actions/checkout.git synced 2025-03-28 11:00:05 +01:00

adding code for public action test

This commit is contained in:
Kenneth Garza 2021-02-03 11:39:11 -05:00
parent 5a4ac9002d
commit d4bc74899d
3 changed files with 19 additions and 3 deletions

2
dist/index.js vendored
View file

@ -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');
}

View file

@ -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) {

View file

@ -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