UNPKG

jsii-release

Version:

Release jsii modules to multiple package managers

116 lines (115 loc) 3.47 kB
export interface CloneOptions { /** * @default 1 */ readonly depth?: number; /** * @default false */ readonly tags?: boolean; /** * @default - default branch */ readonly branch?: string; } /** * Clones a repository from GitHub. Requires a `GITHUB_TOKEN` env variable. * * @param repositoryUrl the repository to clone. * @param targetDir the clone directory. */ export declare function clone(repositoryUrl: string, targetDir: string, { depth, tags, branch }?: CloneOptions): void; /** * Checks if the current environment is an GHE environment. * * This check is using GITHUB_API_URL set in GitHub Actions workflow, as well as common gh cli env variables. * https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables * https://cli.github.com/manual/gh_help_environment * * @return - `true` if GH_HOST or GITHUB_API_URL env var are defined and not equal to the public github endpoint, otherwise `false` */ export declare function detectGHE(): boolean; /** * Returns an appropriate github token from the environment. * * @return GH_ENTERPRISE_TOKEN or GITHUB_ENTERPRISE_TOKEN or GITHUB_TOKEN if in an GHE environment, otherwise GITHUB_TOKEN */ export declare function getToken(isGHE: boolean): (string | undefined); /** * Checks if SSH should be used to clone repo. * This checks the presence and values of the GIT_USE_SSH env variable and the deprecated GITHUB_USE_SSH for legacy reason. Returns true if either of these env vars are defined and not falsy. */ export declare function detectSSH(): boolean; /** * Query the git index for changes. * * @return True if changes exist, False otherwise. */ export declare function diffIndex(): boolean; /** * Add files to the index. * * @param p the path. */ export declare function add(p: string): void; /** * Remove files from the working tree and from the index * * @param p the path. */ export declare function rm(p: string, options?: { recursive?: boolean; }): void; /** * Commit. * * @param message the commit message. */ export declare function commit(message: string): void; /** * Initialize a repository. */ export declare function init(): void; /** * Cerate a tag. * * @param name tag name. * @returns true if the tag was created, false if it already exists. */ export declare function tag(name: string): boolean; /** * Push a ref to origin. * * @param ref the ref */ export declare function push(ref: string): void; /** * Checkout to a new branch. Creates a new one if `options.createIfMissing` is True and the branch doesn't exist. * * @param branch the branch. * @param options options. */ export declare function checkout(branch: string, options: { createIfMissing?: boolean; }): void; /** * Fetch the configured git user name for the current directory. * Returns undefined if not configured. */ export declare function username(): string | undefined; /** * Fetch the configured git user email for the current directory. * Returns undefined if not configured. */ export declare function email(): string | undefined; /** * Identify the committer with a username and email. * * @param user the username. * @param email the email address. */ export declare function identify(user: string, address: string): void; /** * Does the given branch exists on the remote. */ export declare function branchExistsOnRemote(repositoryUrl: string, branch: string): boolean;