import { f as ChangedFile } from "./index-C9WMO_Y9.mjs"; import { Endpoints } from "@octokit/types"; import { Octokit } from "@octokit/rest"; //#region src/github/checkRun.d.ts type Output = NonNullable; type Annotation = NonNullable[number]; /** * {@link https://docs.github.com/en/rest/reference/checks#create-a-check-run} */ interface CreateCheckRunParameters { /** * Adds information from your analysis to specific lines of code. * Annotations are visible on GitHub in the **Checks** and **Files changed** * tab of the pull request. */ annotations: Annotation[]; /** * The final conclusion of the check. */ conclusion: 'failure' | 'success'; /** * The name of the check. For example, "code-coverage". */ name: string; /** * The summary of the check run. This parameter supports Markdown. */ summary: string; /** * The details of the check run. This parameter supports Markdown. */ text?: string; /** * The title of the check run. */ title: string; } /** * Asynchronously creates a GitHub check run with annotations. * * The first 50 `annotations` are written in full to GitHub. * * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with the `checks:write` permission * must be present on the environment. */ declare const createCheckRun: ({ annotations, conclusion, name, summary, text, title }: CreateCheckRunParameters) => Promise; //#endregion //#region src/github/environment.d.ts /** * Returns the name of the build as seen in GitHub status checks. * * This is driven off of environment variables and falls back to `Build`. */ declare const buildNameFromEnvironment: (env?: NodeJS.ProcessEnv) => string; /** * Whether GitHub API interactions should be enabled. * * This checks environment variables to see if the code is executing in a CI * environment and has access to a GitHub API token. */ declare const enabledFromEnvironment: (env?: NodeJS.ProcessEnv) => boolean; /** * Tries to return a GitHub API token from the environment. */ declare const apiTokenFromEnvironment: (env?: NodeJS.ProcessEnv) => string | undefined; //#endregion //#region src/github/pullRequest.d.ts interface GetPullRequestParameters { /** * A preconstructed Octokit client to interact with GitHub's APIs. * * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with write permissions must be * present on the environment if this is not provided. */ client?: Octokit; env?: Record; } /** * Gets the number of the current pull request. * * This tries to extract the pull request from common CI environment variables, * and falls back to querying the GitHub Repos API for the latest pull request * associated with the head commit. An error is thrown if there are no * associated pull requests, or if they are all closed or locked. */ declare const getPullRequestNumber: (params?: GetPullRequestParameters) => Promise; //#endregion //#region src/github/issueComment.d.ts /** * https://docs.github.com/en/rest/reference/issues#create-an-issue-comment */ interface PutIssueCommentParameters { /** * The body of the issue comment. * * An explicit `null` value will remove the comment, if `internalId` is provided. */ body: string | null; /** * An internal identifier for the issue comment. * * This can be used to scope a given `put` to a particular comment, preventing * it from clobbering other comments from the same bot or user. * * The identifier is embedded as hidden content in the comment body. */ internalId?: string; env?: Record; /** * The number that identifies the GitHub issue. * * If this is not provided, the number will be inferred from the GitHub Repos * API by finding the latest pull request associated with the head commit. * * https://docs.github.com/en/rest/reference/repos#list-pull-requests-associated-with-a-commit */ issueNumber?: number; /** * The ID of authenticated bot or user that is putting the issue comment. * * This drives our `put` behaviour, which tries to locate and edit an existing * comment before creating a new one. If this is not provided, the ID will be * inferred from the GitHub Users API. * * https://docs.github.com/en/rest/reference/users#get-the-authenticated-user * * If you're at SEEK and using BuildAgency's GitHub API integration, you may * use `'seek-build-agency'` as an optimisation to skip the user lookup. * * https://api.github.com/users/buildagencygitapitoken[bot] */ userId?: number | 'seek-build-agency'; } interface IssueComment { id: number; } /** * Asynchronously creates or updates a GitHub issue comment. * * This emulates `put` behaviour by overwriting the first existing comment by * the same author on the issue, enabling use cases like a persistent bot * comment at the top of the pull request that reflects the current status of a * CI check. * * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with write permissions must be present * on the environment. */ declare const putIssueComment: (params: PutIssueCommentParameters) => Promise; //#endregion //#region src/github/push.d.ts interface UploadAllFileChangesParams { dir: string; /** * The branch name */ branch: string; /** * The headline of the commit message */ messageHeadline: string; /** * File changes to exclude from the upload. * * Defaults to `[]` (no exclusions). */ ignore?: ChangedFile[]; /** * The body of the commit message */ messageBody?: string; /** * Updates the local Git repository to match the new remote branch state */ updateLocal?: boolean; } /** * Retrieves all file changes from the local Git repository using * `getChangedFiles`, then uploads the changes to a specified GitHub branch * using `uploadFileChanges`. * * Returns the commit ID, or `undefined` if there are no changes to commit. * * The file changes will appear as verified commits on GitHub. * * This will not update the local Git repository unless `updateLocal` is * specified. */ declare const uploadAllFileChanges: ({ branch, dir, messageHeadline, ignore, messageBody, updateLocal }: UploadAllFileChangesParams) => Promise; interface FileAddition { contents: unknown; path: string; } interface FileDeletion { path: string; } interface FileChanges { additions: FileAddition[]; deletions: FileDeletion[]; } /** * Takes a list of `ChangedFiles`, reads them from the file system, and maps * them to GitHub GraphQL `FileChanges`. * * https://docs.github.com/en/graphql/reference/input-objects#filechanges */ declare const readFileChanges: (dir: string, changedFiles: ChangedFile[]) => Promise; interface UploadFileChangesParams { dir: string; /** * The branch name */ branch: string; /** * The headline of the commit message */ messageHeadline: string; /** * The body of the commit message */ messageBody?: string; /** * File additions and deletions */ fileChanges: FileChanges; } /** * Uploads file changes from the local workspace to a specified GitHub branch. * * The file changes will appear as verified commits on GitHub. * * This will not update the local Git repository. */ declare const uploadFileChanges: ({ dir, branch, messageHeadline, messageBody, fileChanges }: UploadFileChangesParams) => Promise; declare namespace index_d_exports { export { Annotation, apiTokenFromEnvironment, buildNameFromEnvironment, createCheckRun, enabledFromEnvironment, getPullRequestNumber, putIssueComment, readFileChanges, uploadAllFileChanges, uploadFileChanges }; } //#endregion export { putIssueComment as a, buildNameFromEnvironment as c, createCheckRun as d, uploadFileChanges as i, enabledFromEnvironment as l, readFileChanges as n, getPullRequestNumber as o, uploadAllFileChanges as r, apiTokenFromEnvironment as s, index_d_exports as t, Annotation as u };