import * as _backstage_plugin_scaffolder_node from '@backstage/plugin-scaffolder-node';
import * as _backstage_types from '@backstage/types';
import { ScmIntegrations, GithubCredentialsProvider, ScmIntegrationRegistry } from '@backstage/integration';
import { Config } from '@backstage/config';
import { Octokit } from 'octokit';
import { createPullRequest } from 'octokit-plugin-create-pull-request';

/**
 * Creates a new action that dispatches a GitHub Action workflow for a given branch or tag.
 * @public
 */
declare function createGithubActionsDispatchAction(options: {
    integrations: ScmIntegrations;
    githubCredentialsProvider?: GithubCredentialsProvider;
}): _backstage_plugin_scaffolder_node.TemplateAction<{
    repoUrl: string;
    workflowId: string;
    branchOrTagName: string;
    workflowInputs?: {
        [key: string]: string;
    } | undefined;
    token?: string | undefined;
}, _backstage_types.JsonObject>;

/**
 * Adds labels to a pull request or issue on GitHub
 * @public
 */
declare function createGithubIssuesLabelAction(options: {
    integrations: ScmIntegrationRegistry;
    githubCredentialsProvider?: GithubCredentialsProvider;
}): _backstage_plugin_scaffolder_node.TemplateAction<{
    repoUrl: string;
    number: number;
    labels: string[];
    token?: string | undefined;
}, _backstage_types.JsonObject>;

/**
 * Creates a new action that initializes a git repository
 *
 * @public
 */
declare function createGithubRepoCreateAction(options: {
    integrations: ScmIntegrationRegistry;
    githubCredentialsProvider?: GithubCredentialsProvider;
}): _backstage_plugin_scaffolder_node.TemplateAction<{
    repoUrl: string;
    description?: string | undefined;
    homepage?: string | undefined;
    access?: string | undefined;
    deleteBranchOnMerge?: boolean | undefined;
    gitAuthorName?: string | undefined;
    gitAuthorEmail?: string | undefined;
    allowRebaseMerge?: boolean | undefined;
    allowSquashMerge?: boolean | undefined;
    squashMergeCommitTitle?: "PR_TITLE" | "COMMIT_OR_PR_TITLE" | undefined;
    squashMergeCommitMessage?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK" | undefined;
    allowMergeCommit?: boolean | undefined;
    allowAutoMerge?: boolean | undefined;
    requireCodeOwnerReviews?: boolean | undefined;
    bypassPullRequestAllowances?: {
        users?: string[] | undefined;
        teams?: string[] | undefined;
        apps?: string[] | undefined;
    } | undefined;
    requiredApprovingReviewCount?: number | undefined;
    restrictions?: {
        users: string[];
        teams: string[];
        apps?: string[] | undefined;
    } | undefined;
    requiredStatusCheckContexts?: string[] | undefined;
    requireBranchesToBeUpToDate?: boolean | undefined;
    requiredConversationResolution?: boolean | undefined;
    repoVisibility?: "internal" | "private" | "public" | undefined;
    collaborators?: ({
        user: string;
        access: string;
    } | {
        team: string;
        access: string;
    } | {
        /** @deprecated This field is deprecated in favor of team */
        username: string;
        access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
    })[] | undefined;
    hasProjects?: boolean | undefined;
    hasWiki?: boolean | undefined;
    hasIssues?: boolean | undefined;
    token?: string | undefined;
    topics?: string[] | undefined;
    repoVariables?: {
        [key: string]: string;
    } | undefined;
    secrets?: {
        [key: string]: string;
    } | undefined;
    requireCommitSigning?: boolean | undefined;
}, _backstage_types.JsonObject>;

/**
 * Creates a new action that initializes a git repository of the content in the workspace
 * and publishes it to GitHub.
 *
 * @public
 */
declare function createGithubRepoPushAction(options: {
    integrations: ScmIntegrationRegistry;
    config: Config;
    githubCredentialsProvider?: GithubCredentialsProvider;
}): _backstage_plugin_scaffolder_node.TemplateAction<{
    repoUrl: string;
    description?: string | undefined;
    defaultBranch?: string | undefined;
    protectDefaultBranch?: boolean | undefined;
    protectEnforceAdmins?: boolean | undefined;
    gitCommitMessage?: string | undefined;
    gitAuthorName?: string | undefined;
    gitAuthorEmail?: string | undefined;
    requireCodeOwnerReviews?: boolean | undefined;
    dismissStaleReviews?: boolean | undefined;
    bypassPullRequestAllowances?: {
        users?: string[];
        teams?: string[];
        apps?: string[];
    } | undefined;
    requiredApprovingReviewCount?: number | undefined;
    restrictions?: {
        users: string[];
        teams: string[];
        apps?: string[];
    } | undefined;
    requiredStatusCheckContexts?: string[] | undefined;
    requireBranchesToBeUpToDate?: boolean | undefined;
    requiredConversationResolution?: boolean | undefined;
    sourcePath?: string | undefined;
    token?: string | undefined;
    requiredCommitSigning?: boolean | undefined;
}, _backstage_types.JsonObject>;

/**
 * Creates new action that creates a webhook for a repository on GitHub.
 * @public
 */
declare function createGithubWebhookAction(options: {
    integrations: ScmIntegrationRegistry;
    defaultWebhookSecret?: string;
    githubCredentialsProvider?: GithubCredentialsProvider;
}): _backstage_plugin_scaffolder_node.TemplateAction<{
    repoUrl: string;
    webhookUrl: string;
    webhookSecret?: string | undefined;
    events?: string[] | undefined;
    active?: boolean | undefined;
    contentType?: "form" | "json" | undefined;
    insecureSsl?: boolean | undefined;
    token?: string | undefined;
}, _backstage_types.JsonObject>;

/**
 * Creates an `github:deployKey:create` Scaffolder action that creates a Deploy Key
 *
 * @public
 */
declare function createGithubDeployKeyAction(options: {
    integrations: ScmIntegrationRegistry;
}): _backstage_plugin_scaffolder_node.TemplateAction<{
    repoUrl: string;
    publicKey: string;
    privateKey: string;
    deployKeyName: string;
    privateKeySecretName?: string | undefined;
    token?: string | undefined;
}, _backstage_types.JsonObject>;

/**
 * Creates an `github:environment:create` Scaffolder action that creates a Github Environment.
 *
 * @public
 */
declare function createGithubEnvironmentAction(options: {
    integrations: ScmIntegrationRegistry;
}): _backstage_plugin_scaffolder_node.TemplateAction<{
    repoUrl: string;
    name: string;
    deploymentBranchPolicy?: {
        protected_branches: boolean;
        custom_branch_policies: boolean;
    } | undefined;
    customBranchPolicyNames?: string[] | undefined;
    environmentVariables?: {
        [key: string]: string;
    } | undefined;
    secrets?: {
        [key: string]: string;
    } | undefined;
    token?: string | undefined;
}, _backstage_types.JsonObject>;

/**
 * The options passed to {@link createPublishGithubPullRequestAction} method
 * @public
 */
interface CreateGithubPullRequestActionOptions {
    /**
     * An instance of {@link @backstage/integration#ScmIntegrationRegistry} that will be used in the action.
     */
    integrations: ScmIntegrationRegistry;
    /**
     * An instance of {@link @backstage/integration#GithubCredentialsProvider} that will be used to get credentials for the action.
     */
    githubCredentialsProvider?: GithubCredentialsProvider;
    /**
     * A method to return the Octokit client with the Pull Request Plugin.
     */
    clientFactory?: (input: {
        integrations: ScmIntegrationRegistry;
        githubCredentialsProvider?: GithubCredentialsProvider;
        host: string;
        owner: string;
        repo: string;
        token?: string;
    }) => Promise<Octokit & {
        createPullRequest(options: createPullRequest.Options): Promise<{
            data: {
                html_url: string;
                number: number;
                base: {
                    ref: string;
                };
            };
        } | null>;
    }>;
}
/**
 * Creates a Github Pull Request action.
 * @public
 */
declare const createPublishGithubPullRequestAction: (options: CreateGithubPullRequestActionOptions) => _backstage_plugin_scaffolder_node.TemplateAction<{
    title: string;
    branchName: string;
    targetBranchName?: string | undefined;
    description: string;
    repoUrl: string;
    draft?: boolean | undefined;
    targetPath?: string | undefined;
    sourcePath?: string | undefined;
    token?: string | undefined;
    reviewers?: string[] | undefined;
    teamReviewers?: string[] | undefined;
    commitMessage?: string | undefined;
    update?: boolean | undefined;
}, _backstage_types.JsonObject>;

/**
 * Creates a new action that initializes a git repository of the content in the workspace
 * and publishes it to GitHub.
 *
 * @public
 */
declare function createPublishGithubAction(options: {
    integrations: ScmIntegrationRegistry;
    config: Config;
    githubCredentialsProvider?: GithubCredentialsProvider;
}): _backstage_plugin_scaffolder_node.TemplateAction<{
    repoUrl: string;
    description?: string | undefined;
    homepage?: string | undefined;
    access?: string | undefined;
    defaultBranch?: string | undefined;
    protectDefaultBranch?: boolean | undefined;
    protectEnforceAdmins?: boolean | undefined;
    deleteBranchOnMerge?: boolean | undefined;
    gitCommitMessage?: string | undefined;
    gitAuthorName?: string | undefined;
    gitAuthorEmail?: string | undefined;
    allowRebaseMerge?: boolean | undefined;
    allowSquashMerge?: boolean | undefined;
    squashMergeCommitTitle?: "PR_TITLE" | "COMMIT_OR_PR_TITLE" | undefined;
    squashMergeCommitMessage?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK" | undefined;
    allowMergeCommit?: boolean | undefined;
    allowAutoMerge?: boolean | undefined;
    sourcePath?: string | undefined;
    bypassPullRequestAllowances?: {
        users?: string[];
        teams?: string[];
        apps?: string[];
    } | undefined;
    requiredApprovingReviewCount?: number | undefined;
    restrictions?: {
        users: string[];
        teams: string[];
        apps?: string[];
    } | undefined;
    requireCodeOwnerReviews?: boolean | undefined;
    dismissStaleReviews?: boolean | undefined;
    requiredStatusCheckContexts?: string[] | undefined;
    requireBranchesToBeUpToDate?: boolean | undefined;
    requiredConversationResolution?: boolean | undefined;
    repoVisibility?: "internal" | "private" | "public" | undefined;
    collaborators?: ({
        user: string;
        access: string;
    } | {
        team: string;
        access: string;
    } | {
        /** @deprecated This field is deprecated in favor of team */
        username: string;
        access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
    })[] | undefined;
    hasProjects?: boolean | undefined;
    hasWiki?: boolean | undefined;
    hasIssues?: boolean | undefined;
    token?: string | undefined;
    topics?: string[] | undefined;
    repoVariables?: {
        [key: string]: string;
    } | undefined;
    secrets?: {
        [key: string]: string;
    } | undefined;
    requiredCommitSigning?: boolean | undefined;
}, _backstage_types.JsonObject>;

/**
 * Create an autolink reference for a repository
 * @public
 */
declare function createGithubAutolinksAction(options: {
    integrations: ScmIntegrations;
    githubCredentialsProvider?: GithubCredentialsProvider;
}): _backstage_plugin_scaffolder_node.TemplateAction<{
    repoUrl: string;
    keyPrefix: string;
    urlTemplate: string;
    isAlphanumeric?: boolean | undefined;
    token?: string | undefined;
}, _backstage_types.JsonObject>;

export { CreateGithubPullRequestActionOptions, createGithubActionsDispatchAction, createGithubAutolinksAction, createGithubDeployKeyAction, createGithubEnvironmentAction, createGithubIssuesLabelAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishGithubAction, createPublishGithubPullRequestAction };
