/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ /** * Common properties used when connecting to GitHub APIs. */ export interface GitHubProps { /** * The owner of the repo. */ owner: string; /** * The name of the repo. */ repo: string; /** * A GitHub access token. * * @remarks * This token should be treated as any other secure/secret value. Do not log it, do not include it in source code, * and do not copy/paste it into insecure inputs. */ token: string; } /** * Returns an array of GitHub usernames that have approved a PR. */ export declare function getPrApprovers({ owner, repo, token }: GitHubProps, prNumber: number): Promise; /** * Check if a GitHub PR is approved by a member of a GitHub team. * * @param github - Details about the GitHub repo and auth to use. * @param prNumber - Pull request number. * @param teamName - The team whose membership should be checked. The team must be in the same GitHub organization as * the repo. Only the team name should be provided - the org is inferred from the repo details. * * @returns `true` if at least one of the users on the team has approved the PR; `false` otherwise. */ export declare function isPrApprovedByTeam(github: GitHubProps, prNumber: number, teamName: string): Promise; /** * Check if a GitHub PR is approved by someone in a list of users. * * @param github - Details about the GitHub repo and auth to use. * @param prNumber - Pull request number. * @param approvers - GitHub users who should be considered approvers. * * @returns `true` if at least one of the approvers has approved the PR; `false` otherwise. */ export declare function isPrApprovedByUsers(github: GitHubProps, prNumber: number, approvers: Set): Promise; /** * Creates or modifies a single review comment on a PR. The comment is identified with a unique identifier, so the same comment is updated on repeated calls. * * @param github - Details about the GitHub repo and auth to use. * @param prNumber - Pull request number. * @param body - review comment body to be posted. * @param commentIdentifier - unique identifier for the comment to be updated. * * @returns id of the comment that was updated. */ export declare function createOrUpdateCommentOnPr({ owner, repo, token }: GitHubProps, prNumber: number, body: string, commentIdentifier: string): Promise; /** * Retrieves body of the comment if commentIdentifier identifies the comment. * * @param github - Details about the GitHub repo and auth to use. * @param prNumber - Pull request number. * @param commentIdentifier - unique identifier for the comment to be updated. * * @returns body of the comment identified by commentIdentifier. */ export declare function getCommentBody({ owner, repo, token }: GitHubProps, prNumber: number, commentIdentifier: string): Promise; /** * Api to get the changed file paths in a PR. The paths are relative to the root of the repo. * @param github - Details about the GitHub repo and auth to use. * @param prNumber - Pr number for which the changed files paths are to be fetched * @returns - List of file paths that are changed in the PR */ export declare function getChangedFilePaths({ owner, repo, token }: GitHubProps, prNumber: number): Promise; //# sourceMappingURL=githubRest.d.ts.map