diff --git a/dist/index.js b/dist/index.js index 882666c..253152d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6366,16 +6366,29 @@ const { Octokit } = __nccwpck_require__(231); const core = __nccwpck_require__(186); const github = __nccwpck_require__(438); const { execSync } = __nccwpck_require__(129); +const { existsSync } = __nccwpck_require__(747); +const { join } = __nccwpck_require__(622); const { runId, repo: { repo, owner }, eventName } = github.context; process.env.GITHUB_TOKEN = process.argv[2]; const mainBranchName = process.argv[3]; const errorOnNoSuccessfulWorkflow = process.argv[4]; const lastSuccessfulEvent = process.argv[5]; -const workflowId = process.argv[6]; +const workingDirectory = process.argv[6]; +const workflowId = process.argv[7]; +const defaultWorkingDirectory = '.'; let BASE_SHA; (async () => { + if (workingDirectory !== defaultWorkingDirectory) { + if (existsSync(workingDirectory)) { + process.chdir(join(__dirname, workingDirectory)); + } else { + process.stdout.write('\n'); + process.stdout.write(`WARNING: Working directory '${workingDirectory}' doesn't exist.\n`); + } + } + const HEAD_SHA = execSync(`git rev-parse HEAD`, { encoding: 'utf-8' }); if (eventName === 'pull_request') { @@ -6397,7 +6410,7 @@ let BASE_SHA; process.stdout.write(`WARNING: Unable to find a successful workflow run on 'origin/${mainBranchName}'\n`); process.stdout.write(`We are therefore defaulting to use HEAD~1 on 'origin/${mainBranchName}'\n`); process.stdout.write('\n'); - process.stdout.write(`NOTE: You can instead make this a hard error by settting 'error-on-no-successful-workflow' on the action in your workflow.\n`); + process.stdout.write(`NOTE: You can instead make this a hard error by setting 'error-on-no-successful-workflow' on the action in your workflow.\n`); BASE_SHA = execSync(`git rev-parse HEAD~1`, { encoding: 'utf-8' }); core.setOutput('noPreviousBuild', 'true'); diff --git a/package-lock.json b/package-lock.json index 8e886aa..8cda85b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "version": "2.1.6", + "version": "2.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index c186780..b18609c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "private": true, - "version": "2.1.6", + "version": "2.2.0", "license": "MIT", "description": "This package.json is here purely to control the version of the Action, in combination with https://github.com/JamesHenry/publish-shell-action", "scripts": {