@@ -0,0 +1,28 @@
|
||||
## API Report File for "@backstage/plugin-scaffolder-backend-module-azure"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { Config } from '@backstage/config';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
|
||||
|
||||
// @public
|
||||
export function createPublishAzureAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
description?: string | undefined;
|
||||
defaultBranch?: string | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
token?: string | undefined;
|
||||
gitCommitMessage?: string | undefined;
|
||||
gitAuthorName?: string | undefined;
|
||||
gitAuthorEmail?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
```
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* The azure module for @backstage/plugin-scaffolder-backend.
|
||||
* A module for the scaffolder backend that lets you interact with azure
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
## API Report File for "@backstage/plugin-scaffolder-backend-module-bitbucket"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { Config } from '@backstage/config';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
|
||||
|
||||
// @public @deprecated
|
||||
export function createPublishBitbucketAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
description?: string | undefined;
|
||||
defaultBranch?: string | undefined;
|
||||
repoVisibility?: 'private' | 'public' | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
enableLFS?: boolean | undefined;
|
||||
token?: string | undefined;
|
||||
gitCommitMessage?: string | undefined;
|
||||
gitAuthorName?: string | undefined;
|
||||
gitAuthorEmail?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishBitbucketCloudAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
description?: string | undefined;
|
||||
defaultBranch?: string | undefined;
|
||||
repoVisibility?: 'private' | 'public' | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
token?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishBitbucketServerAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
description?: string | undefined;
|
||||
defaultBranch?: string | undefined;
|
||||
repoVisibility?: 'private' | 'public' | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
enableLFS?: boolean | undefined;
|
||||
token?: string | undefined;
|
||||
gitCommitMessage?: string | undefined;
|
||||
gitAuthorName?: string | undefined;
|
||||
gitAuthorEmail?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishBitbucketServerPullRequestAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
title: string;
|
||||
description?: string | undefined;
|
||||
targetBranch?: string | undefined;
|
||||
sourceBranch: string;
|
||||
token?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
```
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* The bitbucket module for @backstage/plugin-scaffolder-backend.
|
||||
* A module for the scaffolder backend that lets you interact with bitbucket
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
## API Report File for "@backstage/plugin-scaffolder-backend-module-gerrit"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { Config } from '@backstage/config';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
|
||||
|
||||
// @public
|
||||
export function createPublishGerritAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
description: string;
|
||||
defaultBranch?: string | undefined;
|
||||
gitCommitMessage?: string | undefined;
|
||||
gitAuthorName?: string | undefined;
|
||||
gitAuthorEmail?: string | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishGerritReviewAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
branch?: string | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
gitCommitMessage?: string | undefined;
|
||||
gitAuthorName?: string | undefined;
|
||||
gitAuthorEmail?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
```
|
||||
@@ -23,10 +23,10 @@
|
||||
"postpack": "backstage-cli package postpack"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/plugin-scaffolder-node": "workspace:^",
|
||||
"@backstage/config": "workspace:^",
|
||||
"@backstage/errors": "workspace:^",
|
||||
"@backstage/integration": "workspace:^",
|
||||
"@backstage/config": "workspace:^",
|
||||
"@backstage/plugin-scaffolder-node": "workspace:^",
|
||||
"node-fetch": "^2.6.7",
|
||||
"yaml": "^2.0.0"
|
||||
},
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* The gerrit module for @backstage/plugin-scaffolder-backend.
|
||||
* A module for the scaffolder backend that lets you interact with gerrit
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,365 @@
|
||||
## API Report File for "@backstage/plugin-scaffolder-backend-module-github"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { Config } from '@backstage/config';
|
||||
import { createPullRequest } from 'octokit-plugin-create-pull-request';
|
||||
import { GithubCredentialsProvider } from '@backstage/integration';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { Octokit } from 'octokit';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
|
||||
|
||||
// @public
|
||||
export function createGithubActionsDispatchAction(options: {
|
||||
integrations: ScmIntegrations;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}): TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
workflowId: string;
|
||||
branchOrTagName: string;
|
||||
workflowInputs?:
|
||||
| {
|
||||
[key: string]: string;
|
||||
}
|
||||
| undefined;
|
||||
token?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createGithubDeployKeyAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
}): TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
publicKey: string;
|
||||
privateKey: string;
|
||||
deployKeyName: string;
|
||||
privateKeySecretName?: string | undefined;
|
||||
token?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createGithubEnvironmentAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
}): 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;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createGithubIssuesLabelAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}): TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
number: number;
|
||||
labels: string[];
|
||||
token?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export interface CreateGithubPullRequestActionOptions {
|
||||
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>;
|
||||
}
|
||||
>;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
integrations: ScmIntegrationRegistry;
|
||||
}
|
||||
|
||||
// @public
|
||||
export function createGithubRepoCreateAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}): 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;
|
||||
}
|
||||
| {
|
||||
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;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createGithubRepoPushAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}): 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;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createGithubWebhookAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
defaultWebhookSecret?: string;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}): TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
webhookUrl: string;
|
||||
webhookSecret?: string | undefined;
|
||||
events?: string[] | undefined;
|
||||
active?: boolean | undefined;
|
||||
contentType?: 'form' | 'json' | undefined;
|
||||
insecureSsl?: boolean | undefined;
|
||||
token?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishGithubAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}): 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;
|
||||
}
|
||||
| {
|
||||
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;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export const createPublishGithubPullRequestAction: (
|
||||
options: CreateGithubPullRequestActionOptions,
|
||||
) => 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;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
```
|
||||
+2
-7
@@ -23,10 +23,7 @@ import {
|
||||
ScmIntegrations,
|
||||
} from '@backstage/integration';
|
||||
import { PassThrough } from 'stream';
|
||||
import {
|
||||
OctokitWithPullRequestPluginClient,
|
||||
createPublishGithubPullRequestAction,
|
||||
} from './githubPullRequest';
|
||||
import { createPublishGithubPullRequestAction } from './githubPullRequest';
|
||||
import yaml from 'yaml';
|
||||
import { examples } from './githubPullRequest.examples';
|
||||
import { createMockDirectory } from '@backstage/backend-test-utils';
|
||||
@@ -103,9 +100,7 @@ describe('publish:github:pull-request examples', () => {
|
||||
},
|
||||
};
|
||||
|
||||
const clientFactory = jest.fn(
|
||||
async () => fakeClient as unknown as OctokitWithPullRequestPluginClient,
|
||||
);
|
||||
const clientFactory = jest.fn(async () => fakeClient as any);
|
||||
|
||||
mockDir.setContent({
|
||||
[workspacePath]: { 'file.txt': 'Hello there!' },
|
||||
|
||||
@@ -26,10 +26,7 @@ import {
|
||||
} from '@backstage/plugin-scaffolder-node';
|
||||
import fs from 'fs-extra';
|
||||
import { Writable } from 'stream';
|
||||
import {
|
||||
createPublishGithubPullRequestAction,
|
||||
OctokitWithPullRequestPluginClient,
|
||||
} from './githubPullRequest';
|
||||
import { createPublishGithubPullRequestAction } from './githubPullRequest';
|
||||
import { createMockDirectory } from '@backstage/backend-test-utils';
|
||||
|
||||
// Make sure root logger is initialized ahead of FS mock
|
||||
@@ -78,9 +75,7 @@ describe('createPublishGithubPullRequestAction', () => {
|
||||
},
|
||||
},
|
||||
};
|
||||
const clientFactory = jest.fn(
|
||||
async () => fakeClient as unknown as OctokitWithPullRequestPluginClient,
|
||||
);
|
||||
const clientFactory = jest.fn(async () => fakeClient as any);
|
||||
const githubCredentialsProvider: GithubCredentialsProvider = {
|
||||
getCredentials: jest.fn(),
|
||||
};
|
||||
|
||||
@@ -37,57 +37,32 @@ export type Encoding = 'utf-8' | 'base64';
|
||||
|
||||
class GithubResponseError extends CustomErrorBase {}
|
||||
|
||||
/** @public */
|
||||
export type OctokitWithPullRequestPluginClient = Octokit & {
|
||||
createPullRequest(options: createPullRequest.Options): Promise<{
|
||||
data: {
|
||||
html_url: string;
|
||||
number: number;
|
||||
base: {
|
||||
ref: string;
|
||||
};
|
||||
};
|
||||
} | null>;
|
||||
};
|
||||
|
||||
/**
|
||||
* The options passed to the client factory function.
|
||||
* @public
|
||||
*/
|
||||
export type CreateGithubPullRequestClientFactoryInput = {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
host: string;
|
||||
owner: string;
|
||||
repo: string;
|
||||
token?: string;
|
||||
};
|
||||
|
||||
export const defaultClientFactory = async ({
|
||||
integrations,
|
||||
githubCredentialsProvider,
|
||||
owner,
|
||||
repo,
|
||||
host = 'github.com',
|
||||
token: providedToken,
|
||||
}: CreateGithubPullRequestClientFactoryInput): Promise<OctokitWithPullRequestPluginClient> => {
|
||||
const [encodedHost, encodedOwner, encodedRepo] = [host, owner, repo].map(
|
||||
encodeURIComponent,
|
||||
);
|
||||
|
||||
const octokitOptions = await getOctokitOptions({
|
||||
export const defaultClientFactory: CreateGithubPullRequestActionOptions['clientFactory'] =
|
||||
async ({
|
||||
integrations,
|
||||
credentialsProvider: githubCredentialsProvider,
|
||||
repoUrl: `${encodedHost}?owner=${encodedOwner}&repo=${encodedRepo}`,
|
||||
githubCredentialsProvider,
|
||||
owner,
|
||||
repo,
|
||||
host = 'github.com',
|
||||
token: providedToken,
|
||||
});
|
||||
}) => {
|
||||
const [encodedHost, encodedOwner, encodedRepo] = [host, owner, repo].map(
|
||||
encodeURIComponent,
|
||||
);
|
||||
|
||||
const OctokitPR = Octokit.plugin(createPullRequest);
|
||||
return new OctokitPR({
|
||||
...octokitOptions,
|
||||
...{ throttle: { enabled: false } },
|
||||
});
|
||||
};
|
||||
const octokitOptions = await getOctokitOptions({
|
||||
integrations,
|
||||
credentialsProvider: githubCredentialsProvider,
|
||||
repoUrl: `${encodedHost}?owner=${encodedOwner}&repo=${encodedRepo}`,
|
||||
token: providedToken,
|
||||
});
|
||||
|
||||
const OctokitPR = Octokit.plugin(createPullRequest);
|
||||
return new OctokitPR({
|
||||
...octokitOptions,
|
||||
...{ throttle: { enabled: false } },
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* The options passed to {@link createPublishGithubPullRequestAction} method
|
||||
@@ -105,9 +80,26 @@ export interface CreateGithubPullRequestActionOptions {
|
||||
/**
|
||||
* A method to return the Octokit client with the Pull Request Plugin.
|
||||
*/
|
||||
clientFactory?: (
|
||||
input: CreateGithubPullRequestClientFactoryInput,
|
||||
) => Promise<OctokitWithPullRequestPluginClient>;
|
||||
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>;
|
||||
}
|
||||
>;
|
||||
}
|
||||
|
||||
type GithubPullRequest = {
|
||||
|
||||
@@ -22,5 +22,8 @@ export { createGithubWebhookAction } from './githubWebhook';
|
||||
export { createGithubDeployKeyAction } from './githubDeployKey';
|
||||
export { createGithubEnvironmentAction } from './githubEnvironment';
|
||||
|
||||
export { createPublishGithubPullRequestAction } from './githubPullRequest';
|
||||
export {
|
||||
createPublishGithubPullRequestAction,
|
||||
type CreateGithubPullRequestActionOptions,
|
||||
} from './githubPullRequest';
|
||||
export { createPublishGithubAction } from './github';
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* The github module for @backstage/plugin-scaffolder-backend.
|
||||
* A module for the scaffolder backend that lets you interact with github
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { Config } from '@backstage/config';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
|
||||
@@ -74,4 +75,75 @@ export const createGitlabProjectVariableAction: (options: {
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishGitlabAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
defaultBranch?: string | undefined;
|
||||
repoVisibility?: 'internal' | 'private' | 'public' | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
token?: string | undefined;
|
||||
gitCommitMessage?: string | undefined;
|
||||
gitAuthorName?: string | undefined;
|
||||
gitAuthorEmail?: string | undefined;
|
||||
setUserAsOwner?: boolean | undefined;
|
||||
topics?: string[] | undefined;
|
||||
settings?:
|
||||
| {
|
||||
path?: string | undefined;
|
||||
auto_devops_enabled?: boolean | undefined;
|
||||
ci_config_path?: string | undefined;
|
||||
description?: string | undefined;
|
||||
topics?: string[] | undefined;
|
||||
visibility?: 'internal' | 'private' | 'public' | undefined;
|
||||
}
|
||||
| undefined;
|
||||
branches?:
|
||||
| {
|
||||
name: string;
|
||||
protect?: boolean | undefined;
|
||||
create?: boolean | undefined;
|
||||
ref?: string | undefined;
|
||||
}[]
|
||||
| undefined;
|
||||
projectVariables?:
|
||||
| {
|
||||
key: string;
|
||||
value: string;
|
||||
description?: string | undefined;
|
||||
variable_type?: string | undefined;
|
||||
protected?: boolean | undefined;
|
||||
masked?: boolean | undefined;
|
||||
raw?: boolean | undefined;
|
||||
environment_scope?: string | undefined;
|
||||
}[]
|
||||
| undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export const createPublishGitlabMergeRequestAction: (options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
}) => TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
title: string;
|
||||
description: string;
|
||||
branchName: string;
|
||||
targetBranchName?: string | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
targetPath?: string | undefined;
|
||||
token?: string | undefined;
|
||||
commitAction?: 'update' | 'delete' | 'create' | undefined;
|
||||
projectid?: string | undefined;
|
||||
removeSourceBranch?: boolean | undefined;
|
||||
assignee?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
```
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 The Backstage Authors
|
||||
* Copyright 2023 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,4 +19,5 @@
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
export * from './actions';
|
||||
|
||||
@@ -6,19 +6,16 @@
|
||||
import { ActionContext as ActionContext_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { CatalogApi } from '@backstage/catalog-client';
|
||||
import { Config } from '@backstage/config';
|
||||
import { createPullRequest } from 'octokit-plugin-create-pull-request';
|
||||
import { Duration } from 'luxon';
|
||||
import { executeShellCommand as executeShellCommand_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { ExecuteShellCommandOptions } from '@backstage/plugin-scaffolder-node';
|
||||
import express from 'express';
|
||||
import { fetchContents as fetchContents_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { GithubCredentialsProvider } from '@backstage/integration';
|
||||
import { HumanDuration } from '@backstage/types';
|
||||
import { IdentityApi } from '@backstage/plugin-auth-node';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { Knex } from 'knex';
|
||||
import { Logger } from 'winston';
|
||||
import { Octokit } from 'octokit';
|
||||
import { PermissionEvaluator } from '@backstage/plugin-permission-common';
|
||||
import { PermissionRule } from '@backstage/plugin-permission-node';
|
||||
import { PermissionRuleParams } from '@backstage/plugin-permission-common';
|
||||
@@ -28,7 +25,6 @@ import { RESOURCE_TYPE_SCAFFOLDER_ACTION } from '@backstage/plugin-scaffolder-co
|
||||
import { RESOURCE_TYPE_SCAFFOLDER_TEMPLATE } from '@backstage/plugin-scaffolder-common/alpha';
|
||||
import { ScaffolderEntitiesProcessor as ScaffolderEntitiesProcessor_2 } from '@backstage/plugin-catalog-backend-module-scaffolder-entity-model';
|
||||
import { Schema } from 'jsonschema';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import { SerializedTask as SerializedTask_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { SerializedTaskEvent as SerializedTaskEvent_2 } from '@backstage/plugin-scaffolder-node';
|
||||
@@ -197,544 +193,6 @@ export const createFilesystemRenameAction: () => TemplateAction_2<
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createGithubActionsDispatchAction(options: {
|
||||
integrations: ScmIntegrations;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
repoUrl: string;
|
||||
workflowId: string;
|
||||
branchOrTagName: string;
|
||||
workflowInputs?:
|
||||
| {
|
||||
[key: string]: string;
|
||||
}
|
||||
| undefined;
|
||||
token?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createGithubDeployKeyAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
repoUrl: string;
|
||||
publicKey: string;
|
||||
privateKey: string;
|
||||
deployKeyName: string;
|
||||
privateKeySecretName?: string | undefined;
|
||||
token?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createGithubEnvironmentAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
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;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createGithubIssuesLabelAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
repoUrl: string;
|
||||
number: number;
|
||||
labels: string[];
|
||||
token?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export interface CreateGithubPullRequestActionOptions {
|
||||
clientFactory?: (
|
||||
input: CreateGithubPullRequestClientFactoryInput,
|
||||
) => Promise<OctokitWithPullRequestPluginClient>;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
integrations: ScmIntegrationRegistry;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type CreateGithubPullRequestClientFactoryInput = {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
host: string;
|
||||
owner: string;
|
||||
repo: string;
|
||||
token?: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export function createGithubRepoCreateAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
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;
|
||||
}
|
||||
| {
|
||||
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;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createGithubRepoPushAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
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;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createGithubWebhookAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
defaultWebhookSecret?: string;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
repoUrl: string;
|
||||
webhookUrl: string;
|
||||
webhookSecret?: string | undefined;
|
||||
events?: string[] | undefined;
|
||||
active?: boolean | undefined;
|
||||
contentType?: 'form' | 'json' | undefined;
|
||||
insecureSsl?: boolean | undefined;
|
||||
token?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishAzureAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
repoUrl: string;
|
||||
description?: string | undefined;
|
||||
defaultBranch?: string | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
token?: string | undefined;
|
||||
gitCommitMessage?: string | undefined;
|
||||
gitAuthorName?: string | undefined;
|
||||
gitAuthorEmail?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public @deprecated
|
||||
export function createPublishBitbucketAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
repoUrl: string;
|
||||
description?: string | undefined;
|
||||
defaultBranch?: string | undefined;
|
||||
repoVisibility?: 'private' | 'public' | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
enableLFS?: boolean | undefined;
|
||||
token?: string | undefined;
|
||||
gitCommitMessage?: string | undefined;
|
||||
gitAuthorName?: string | undefined;
|
||||
gitAuthorEmail?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishBitbucketCloudAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
repoUrl: string;
|
||||
description?: string | undefined;
|
||||
defaultBranch?: string | undefined;
|
||||
repoVisibility?: 'private' | 'public' | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
token?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishBitbucketServerAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
repoUrl: string;
|
||||
description?: string | undefined;
|
||||
defaultBranch?: string | undefined;
|
||||
repoVisibility?: 'private' | 'public' | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
enableLFS?: boolean | undefined;
|
||||
token?: string | undefined;
|
||||
gitCommitMessage?: string | undefined;
|
||||
gitAuthorName?: string | undefined;
|
||||
gitAuthorEmail?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishBitbucketServerPullRequestAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
repoUrl: string;
|
||||
title: string;
|
||||
description?: string | undefined;
|
||||
targetBranch?: string | undefined;
|
||||
sourceBranch: string;
|
||||
token?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishGerritAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
repoUrl: string;
|
||||
description: string;
|
||||
defaultBranch?: string | undefined;
|
||||
gitCommitMessage?: string | undefined;
|
||||
gitAuthorName?: string | undefined;
|
||||
gitAuthorEmail?: string | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishGerritReviewAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
repoUrl: string;
|
||||
branch?: string | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
gitCommitMessage?: string | undefined;
|
||||
gitAuthorName?: string | undefined;
|
||||
gitAuthorEmail?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishGithubAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
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;
|
||||
}
|
||||
| {
|
||||
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;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export const createPublishGithubPullRequestAction: (
|
||||
options: CreateGithubPullRequestActionOptions,
|
||||
) => TemplateAction_2<
|
||||
{
|
||||
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;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createPublishGitlabAction(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
config: Config;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
repoUrl: string;
|
||||
defaultBranch?: string | undefined;
|
||||
repoVisibility?: 'internal' | 'private' | 'public' | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
token?: string | undefined;
|
||||
gitCommitMessage?: string | undefined;
|
||||
gitAuthorName?: string | undefined;
|
||||
gitAuthorEmail?: string | undefined;
|
||||
setUserAsOwner?: boolean | undefined;
|
||||
topics?: string[] | undefined;
|
||||
settings?:
|
||||
| {
|
||||
path?: string | undefined;
|
||||
auto_devops_enabled?: boolean | undefined;
|
||||
ci_config_path?: string | undefined;
|
||||
description?: string | undefined;
|
||||
topics?: string[] | undefined;
|
||||
visibility?: 'internal' | 'private' | 'public' | undefined;
|
||||
}
|
||||
| undefined;
|
||||
branches?:
|
||||
| {
|
||||
name: string;
|
||||
protect?: boolean | undefined;
|
||||
create?: boolean | undefined;
|
||||
ref?: string | undefined;
|
||||
}[]
|
||||
| undefined;
|
||||
projectVariables?:
|
||||
| {
|
||||
key: string;
|
||||
value: string;
|
||||
description?: string | undefined;
|
||||
variable_type?: string | undefined;
|
||||
protected?: boolean | undefined;
|
||||
masked?: boolean | undefined;
|
||||
raw?: boolean | undefined;
|
||||
environment_scope?: string | undefined;
|
||||
}[]
|
||||
| undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export const createPublishGitlabMergeRequestAction: (options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
}) => TemplateAction_2<
|
||||
{
|
||||
repoUrl: string;
|
||||
title: string;
|
||||
description: string;
|
||||
branchName: string;
|
||||
targetBranchName?: string | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
targetPath?: string | undefined;
|
||||
token?: string | undefined;
|
||||
commitAction?: 'update' | 'delete' | 'create' | undefined;
|
||||
projectid?: string | undefined;
|
||||
removeSourceBranch?: boolean | undefined;
|
||||
assignee?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createRouter(options: RouterOptions): Promise<express.Router>;
|
||||
|
||||
@@ -858,19 +316,6 @@ export const executeShellCommand: typeof executeShellCommand_2;
|
||||
// @public @deprecated
|
||||
export const fetchContents: typeof fetchContents_2;
|
||||
|
||||
// @public (undocumented)
|
||||
export type OctokitWithPullRequestPluginClient = Octokit & {
|
||||
createPullRequest(options: createPullRequest.Options): Promise<{
|
||||
data: {
|
||||
html_url: string;
|
||||
number: number;
|
||||
base: {
|
||||
ref: string;
|
||||
};
|
||||
};
|
||||
} | null>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface RouterOptions {
|
||||
// (undocumented)
|
||||
|
||||
@@ -10,6 +10,7 @@ import { JsonValue } from '@backstage/types';
|
||||
import { Logger } from 'winston';
|
||||
import { Observable } from '@backstage/types';
|
||||
import { Schema } from 'jsonschema';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import { SpawnOptionsWithoutStdio } from 'child_process';
|
||||
import { TaskSpec } from '@backstage/plugin-scaffolder-common';
|
||||
@@ -44,6 +45,37 @@ export type ActionContext<
|
||||
each?: JsonObject;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export function commitAndPushRepo({
|
||||
dir,
|
||||
auth,
|
||||
logger,
|
||||
commitMessage,
|
||||
gitAuthorInfo,
|
||||
branch,
|
||||
remoteRef,
|
||||
}: {
|
||||
dir: string;
|
||||
auth:
|
||||
| {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
| {
|
||||
token: string;
|
||||
};
|
||||
logger: Logger;
|
||||
commitMessage: string;
|
||||
gitAuthorInfo?: {
|
||||
name?: string;
|
||||
email?: string;
|
||||
};
|
||||
branch?: string;
|
||||
remoteRef?: string;
|
||||
}): Promise<{
|
||||
commitHash: string;
|
||||
}>;
|
||||
|
||||
// @public
|
||||
export const createTemplateAction: <
|
||||
TInputParams extends JsonObject = JsonObject,
|
||||
@@ -73,6 +105,12 @@ export const createTemplateAction: <
|
||||
>,
|
||||
) => TemplateAction<TActionInput, TActionOutput>;
|
||||
|
||||
// @public
|
||||
export function deserializeDirectoryContents(
|
||||
targetPath: string,
|
||||
files: SerializedFile[],
|
||||
): Promise<void>;
|
||||
|
||||
// @public
|
||||
export function executeShellCommand(
|
||||
options: ExecuteShellCommandOptions,
|
||||
@@ -104,6 +142,77 @@ export function fetchFile(options: {
|
||||
outputPath: string;
|
||||
}): Promise<void>;
|
||||
|
||||
// @public (undocumented)
|
||||
export const getRepoSourceDirectory: (
|
||||
workspacePath: string,
|
||||
sourcePath: string | undefined,
|
||||
) => string;
|
||||
|
||||
// @public (undocumented)
|
||||
export function initRepoAndPush({
|
||||
dir,
|
||||
remoteUrl,
|
||||
auth,
|
||||
logger,
|
||||
defaultBranch,
|
||||
commitMessage,
|
||||
gitAuthorInfo,
|
||||
}: {
|
||||
dir: string;
|
||||
remoteUrl: string;
|
||||
auth:
|
||||
| {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
| {
|
||||
token: string;
|
||||
};
|
||||
logger: Logger;
|
||||
defaultBranch?: string;
|
||||
commitMessage?: string;
|
||||
gitAuthorInfo?: {
|
||||
name?: string;
|
||||
email?: string;
|
||||
};
|
||||
}): Promise<{
|
||||
commitHash: string;
|
||||
}>;
|
||||
|
||||
// @public (undocumented)
|
||||
export const parseRepoUrl: (
|
||||
repoUrl: string,
|
||||
integrations: ScmIntegrationRegistry,
|
||||
) => {
|
||||
repo: string;
|
||||
host: string;
|
||||
owner?: string | undefined;
|
||||
organization?: string | undefined;
|
||||
workspace?: string | undefined;
|
||||
project?: string | undefined;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export interface SerializedFile {
|
||||
// (undocumented)
|
||||
content: Buffer;
|
||||
// (undocumented)
|
||||
executable?: boolean;
|
||||
// (undocumented)
|
||||
path: string;
|
||||
// (undocumented)
|
||||
symlink?: boolean;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export function serializeDirectoryContents(
|
||||
sourcePath: string,
|
||||
options?: {
|
||||
gitignore?: boolean;
|
||||
globPatterns?: string[];
|
||||
},
|
||||
): Promise<SerializedFile[]>;
|
||||
|
||||
// @public
|
||||
export type SerializedTask = {
|
||||
id: string;
|
||||
|
||||
+6
@@ -17,6 +17,9 @@
|
||||
import { Git } from '@backstage/backend-common';
|
||||
import { Logger } from 'winston';
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export async function initRepoAndPush({
|
||||
dir,
|
||||
remoteUrl,
|
||||
@@ -75,6 +78,9 @@ export async function initRepoAndPush({
|
||||
return { commitHash };
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export async function commitAndPushRepo({
|
||||
dir,
|
||||
auth,
|
||||
@@ -25,5 +25,5 @@ export {
|
||||
} from './executeShellCommand';
|
||||
export { fetchContents, fetchFile } from './fetch';
|
||||
export { type ActionContext, type TemplateAction } from './types';
|
||||
export { initRepoAndPush, commitAndPushRepo } from './repoHelpers';
|
||||
export { initRepoAndPush, commitAndPushRepo } from './gitHelpers';
|
||||
export { parseRepoUrl, getRepoSourceDirectory } from './util';
|
||||
|
||||
@@ -19,6 +19,9 @@ import { isChildPath } from '@backstage/backend-common';
|
||||
import { join as joinPath, normalize as normalizePath } from 'path';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const getRepoSourceDirectory = (
|
||||
workspacePath: string,
|
||||
sourcePath: string | undefined,
|
||||
@@ -37,6 +40,9 @@ export const getRepoSourceDirectory = (
|
||||
return workspacePath;
|
||||
};
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const parseRepoUrl = (
|
||||
repoUrl: string,
|
||||
integrations: ScmIntegrationRegistry,
|
||||
|
||||
@@ -25,7 +25,7 @@ import { SerializedFile } from './types';
|
||||
* This method uses `resolveSafeChildPath` to make sure that files are
|
||||
* not written outside of the target directory.
|
||||
*
|
||||
* @internal
|
||||
* @public
|
||||
*/
|
||||
export async function deserializeDirectoryContents(
|
||||
targetPath: string,
|
||||
|
||||
@@ -41,6 +41,9 @@ async function asyncFilter<T>(
|
||||
return array.filter((_value, index) => filterMap[index]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export async function serializeDirectoryContents(
|
||||
sourcePath: string,
|
||||
options?: {
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface SerializedFile {
|
||||
path: string;
|
||||
content: Buffer;
|
||||
|
||||
@@ -23,7 +23,6 @@ import { JsonObject } from '@backstage/types';
|
||||
export type TemplateGroupFilter = {
|
||||
title?: React.ReactNode;
|
||||
filter: (entity: TemplateEntityV1beta3) => boolean;
|
||||
sort?: (a: TemplateEntityV1beta3, b: TemplateEntityV1beta3) => number;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user