INNER CODE UNIT · TypeScript

assertWorkingDirectory

EndBug/add-and-commit · src/util.ts:25

export function assertWorkingDirectory(dir: string, cwdInput: string): void {
  if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) {
    throw new Error(
      `The cwd input '${neutralizeLogString(cwdInput || '.')}' resolved to '${neutralizeLogString(dir)}', which is not an existing directory. ` +
        'Use a path relative to the runner workspace, or an absolute path that exists ' +
        '(e.g. ${{ github.workspace }}/path — note that $GITHUB_WORKSPACE is not expanded in with:).',
    );
  }
}

function getOctokitClient() {
  const token = getInput('github_token');
  if (!token) {
    throw new Error('github_token is required');
  }
  return getOctokit(token);
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…