@backstage/plugin-scaffolder-backend-module-github 0.1.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +5 -0
- package/dist/index.cjs.js +2426 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +327 -0
- package/package.json +49 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import * as _backstage_plugin_scaffolder_node from '@backstage/plugin-scaffolder-node';
|
|
2
|
+
import * as _backstage_types from '@backstage/types';
|
|
3
|
+
import { ScmIntegrations, GithubCredentialsProvider, ScmIntegrationRegistry } from '@backstage/integration';
|
|
4
|
+
import { Config } from '@backstage/config';
|
|
5
|
+
import { Octokit } from 'octokit';
|
|
6
|
+
import { createPullRequest } from 'octokit-plugin-create-pull-request';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new action that dispatches a GitHub Action workflow for a given branch or tag.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
declare function createGithubActionsDispatchAction(options: {
|
|
13
|
+
integrations: ScmIntegrations;
|
|
14
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
15
|
+
}): _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
16
|
+
repoUrl: string;
|
|
17
|
+
workflowId: string;
|
|
18
|
+
branchOrTagName: string;
|
|
19
|
+
workflowInputs?: {
|
|
20
|
+
[key: string]: string;
|
|
21
|
+
} | undefined;
|
|
22
|
+
token?: string | undefined;
|
|
23
|
+
}, _backstage_types.JsonObject>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Adds labels to a pull request or issue on GitHub
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
declare function createGithubIssuesLabelAction(options: {
|
|
30
|
+
integrations: ScmIntegrationRegistry;
|
|
31
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
32
|
+
}): _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
33
|
+
repoUrl: string;
|
|
34
|
+
number: number;
|
|
35
|
+
labels: string[];
|
|
36
|
+
token?: string | undefined;
|
|
37
|
+
}, _backstage_types.JsonObject>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new action that initializes a git repository
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
declare function createGithubRepoCreateAction(options: {
|
|
45
|
+
integrations: ScmIntegrationRegistry;
|
|
46
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
47
|
+
}): _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
48
|
+
repoUrl: string;
|
|
49
|
+
description?: string | undefined;
|
|
50
|
+
homepage?: string | undefined;
|
|
51
|
+
access?: string | undefined;
|
|
52
|
+
deleteBranchOnMerge?: boolean | undefined;
|
|
53
|
+
gitAuthorName?: string | undefined;
|
|
54
|
+
gitAuthorEmail?: string | undefined;
|
|
55
|
+
allowRebaseMerge?: boolean | undefined;
|
|
56
|
+
allowSquashMerge?: boolean | undefined;
|
|
57
|
+
squashMergeCommitTitle?: "PR_TITLE" | "COMMIT_OR_PR_TITLE" | undefined;
|
|
58
|
+
squashMergeCommitMessage?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK" | undefined;
|
|
59
|
+
allowMergeCommit?: boolean | undefined;
|
|
60
|
+
allowAutoMerge?: boolean | undefined;
|
|
61
|
+
requireCodeOwnerReviews?: boolean | undefined;
|
|
62
|
+
bypassPullRequestAllowances?: {
|
|
63
|
+
users?: string[] | undefined;
|
|
64
|
+
teams?: string[] | undefined;
|
|
65
|
+
apps?: string[] | undefined;
|
|
66
|
+
} | undefined;
|
|
67
|
+
requiredApprovingReviewCount?: number | undefined;
|
|
68
|
+
restrictions?: {
|
|
69
|
+
users: string[];
|
|
70
|
+
teams: string[];
|
|
71
|
+
apps?: string[] | undefined;
|
|
72
|
+
} | undefined;
|
|
73
|
+
requiredStatusCheckContexts?: string[] | undefined;
|
|
74
|
+
requireBranchesToBeUpToDate?: boolean | undefined;
|
|
75
|
+
requiredConversationResolution?: boolean | undefined;
|
|
76
|
+
repoVisibility?: "internal" | "private" | "public" | undefined;
|
|
77
|
+
collaborators?: ({
|
|
78
|
+
user: string;
|
|
79
|
+
access: string;
|
|
80
|
+
} | {
|
|
81
|
+
team: string;
|
|
82
|
+
access: string;
|
|
83
|
+
} | {
|
|
84
|
+
/** @deprecated This field is deprecated in favor of team */
|
|
85
|
+
username: string;
|
|
86
|
+
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
|
|
87
|
+
})[] | undefined;
|
|
88
|
+
hasProjects?: boolean | undefined;
|
|
89
|
+
hasWiki?: boolean | undefined;
|
|
90
|
+
hasIssues?: boolean | undefined;
|
|
91
|
+
token?: string | undefined;
|
|
92
|
+
topics?: string[] | undefined;
|
|
93
|
+
repoVariables?: {
|
|
94
|
+
[key: string]: string;
|
|
95
|
+
} | undefined;
|
|
96
|
+
secrets?: {
|
|
97
|
+
[key: string]: string;
|
|
98
|
+
} | undefined;
|
|
99
|
+
requireCommitSigning?: boolean | undefined;
|
|
100
|
+
}, _backstage_types.JsonObject>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
104
|
+
* and publishes it to GitHub.
|
|
105
|
+
*
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
declare function createGithubRepoPushAction(options: {
|
|
109
|
+
integrations: ScmIntegrationRegistry;
|
|
110
|
+
config: Config;
|
|
111
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
112
|
+
}): _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
113
|
+
repoUrl: string;
|
|
114
|
+
description?: string | undefined;
|
|
115
|
+
defaultBranch?: string | undefined;
|
|
116
|
+
protectDefaultBranch?: boolean | undefined;
|
|
117
|
+
protectEnforceAdmins?: boolean | undefined;
|
|
118
|
+
gitCommitMessage?: string | undefined;
|
|
119
|
+
gitAuthorName?: string | undefined;
|
|
120
|
+
gitAuthorEmail?: string | undefined;
|
|
121
|
+
requireCodeOwnerReviews?: boolean | undefined;
|
|
122
|
+
dismissStaleReviews?: boolean | undefined;
|
|
123
|
+
bypassPullRequestAllowances?: {
|
|
124
|
+
users?: string[];
|
|
125
|
+
teams?: string[];
|
|
126
|
+
apps?: string[];
|
|
127
|
+
} | undefined;
|
|
128
|
+
requiredApprovingReviewCount?: number | undefined;
|
|
129
|
+
restrictions?: {
|
|
130
|
+
users: string[];
|
|
131
|
+
teams: string[];
|
|
132
|
+
apps?: string[];
|
|
133
|
+
} | undefined;
|
|
134
|
+
requiredStatusCheckContexts?: string[] | undefined;
|
|
135
|
+
requireBranchesToBeUpToDate?: boolean | undefined;
|
|
136
|
+
requiredConversationResolution?: boolean | undefined;
|
|
137
|
+
sourcePath?: string | undefined;
|
|
138
|
+
token?: string | undefined;
|
|
139
|
+
requiredCommitSigning?: boolean | undefined;
|
|
140
|
+
}, _backstage_types.JsonObject>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Creates new action that creates a webhook for a repository on GitHub.
|
|
144
|
+
* @public
|
|
145
|
+
*/
|
|
146
|
+
declare function createGithubWebhookAction(options: {
|
|
147
|
+
integrations: ScmIntegrationRegistry;
|
|
148
|
+
defaultWebhookSecret?: string;
|
|
149
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
150
|
+
}): _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
151
|
+
repoUrl: string;
|
|
152
|
+
webhookUrl: string;
|
|
153
|
+
webhookSecret?: string | undefined;
|
|
154
|
+
events?: string[] | undefined;
|
|
155
|
+
active?: boolean | undefined;
|
|
156
|
+
contentType?: "form" | "json" | undefined;
|
|
157
|
+
insecureSsl?: boolean | undefined;
|
|
158
|
+
token?: string | undefined;
|
|
159
|
+
}, _backstage_types.JsonObject>;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Creates an `github:deployKey:create` Scaffolder action that creates a Deploy Key
|
|
163
|
+
*
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
166
|
+
declare function createGithubDeployKeyAction(options: {
|
|
167
|
+
integrations: ScmIntegrationRegistry;
|
|
168
|
+
}): _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
169
|
+
repoUrl: string;
|
|
170
|
+
publicKey: string;
|
|
171
|
+
privateKey: string;
|
|
172
|
+
deployKeyName: string;
|
|
173
|
+
privateKeySecretName?: string | undefined;
|
|
174
|
+
token?: string | undefined;
|
|
175
|
+
}, _backstage_types.JsonObject>;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Creates an `github:environment:create` Scaffolder action that creates a Github Environment.
|
|
179
|
+
*
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
declare function createGithubEnvironmentAction(options: {
|
|
183
|
+
integrations: ScmIntegrationRegistry;
|
|
184
|
+
}): _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
185
|
+
repoUrl: string;
|
|
186
|
+
name: string;
|
|
187
|
+
deploymentBranchPolicy?: {
|
|
188
|
+
protected_branches: boolean;
|
|
189
|
+
custom_branch_policies: boolean;
|
|
190
|
+
} | undefined;
|
|
191
|
+
customBranchPolicyNames?: string[] | undefined;
|
|
192
|
+
environmentVariables?: {
|
|
193
|
+
[key: string]: string;
|
|
194
|
+
} | undefined;
|
|
195
|
+
secrets?: {
|
|
196
|
+
[key: string]: string;
|
|
197
|
+
} | undefined;
|
|
198
|
+
token?: string | undefined;
|
|
199
|
+
}, _backstage_types.JsonObject>;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* The options passed to {@link createPublishGithubPullRequestAction} method
|
|
203
|
+
* @public
|
|
204
|
+
*/
|
|
205
|
+
interface CreateGithubPullRequestActionOptions {
|
|
206
|
+
/**
|
|
207
|
+
* An instance of {@link @backstage/integration#ScmIntegrationRegistry} that will be used in the action.
|
|
208
|
+
*/
|
|
209
|
+
integrations: ScmIntegrationRegistry;
|
|
210
|
+
/**
|
|
211
|
+
* An instance of {@link @backstage/integration#GithubCredentialsProvider} that will be used to get credentials for the action.
|
|
212
|
+
*/
|
|
213
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
214
|
+
/**
|
|
215
|
+
* A method to return the Octokit client with the Pull Request Plugin.
|
|
216
|
+
*/
|
|
217
|
+
clientFactory?: (input: {
|
|
218
|
+
integrations: ScmIntegrationRegistry;
|
|
219
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
220
|
+
host: string;
|
|
221
|
+
owner: string;
|
|
222
|
+
repo: string;
|
|
223
|
+
token?: string;
|
|
224
|
+
}) => Promise<Octokit & {
|
|
225
|
+
createPullRequest(options: createPullRequest.Options): Promise<{
|
|
226
|
+
data: {
|
|
227
|
+
html_url: string;
|
|
228
|
+
number: number;
|
|
229
|
+
base: {
|
|
230
|
+
ref: string;
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
} | null>;
|
|
234
|
+
}>;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Creates a Github Pull Request action.
|
|
238
|
+
* @public
|
|
239
|
+
*/
|
|
240
|
+
declare const createPublishGithubPullRequestAction: (options: CreateGithubPullRequestActionOptions) => _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
241
|
+
title: string;
|
|
242
|
+
branchName: string;
|
|
243
|
+
targetBranchName?: string | undefined;
|
|
244
|
+
description: string;
|
|
245
|
+
repoUrl: string;
|
|
246
|
+
draft?: boolean | undefined;
|
|
247
|
+
targetPath?: string | undefined;
|
|
248
|
+
sourcePath?: string | undefined;
|
|
249
|
+
token?: string | undefined;
|
|
250
|
+
reviewers?: string[] | undefined;
|
|
251
|
+
teamReviewers?: string[] | undefined;
|
|
252
|
+
commitMessage?: string | undefined;
|
|
253
|
+
update?: boolean | undefined;
|
|
254
|
+
}, _backstage_types.JsonObject>;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
258
|
+
* and publishes it to GitHub.
|
|
259
|
+
*
|
|
260
|
+
* @public
|
|
261
|
+
*/
|
|
262
|
+
declare function createPublishGithubAction(options: {
|
|
263
|
+
integrations: ScmIntegrationRegistry;
|
|
264
|
+
config: Config;
|
|
265
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
266
|
+
}): _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
267
|
+
repoUrl: string;
|
|
268
|
+
description?: string | undefined;
|
|
269
|
+
homepage?: string | undefined;
|
|
270
|
+
access?: string | undefined;
|
|
271
|
+
defaultBranch?: string | undefined;
|
|
272
|
+
protectDefaultBranch?: boolean | undefined;
|
|
273
|
+
protectEnforceAdmins?: boolean | undefined;
|
|
274
|
+
deleteBranchOnMerge?: boolean | undefined;
|
|
275
|
+
gitCommitMessage?: string | undefined;
|
|
276
|
+
gitAuthorName?: string | undefined;
|
|
277
|
+
gitAuthorEmail?: string | undefined;
|
|
278
|
+
allowRebaseMerge?: boolean | undefined;
|
|
279
|
+
allowSquashMerge?: boolean | undefined;
|
|
280
|
+
squashMergeCommitTitle?: "PR_TITLE" | "COMMIT_OR_PR_TITLE" | undefined;
|
|
281
|
+
squashMergeCommitMessage?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK" | undefined;
|
|
282
|
+
allowMergeCommit?: boolean | undefined;
|
|
283
|
+
allowAutoMerge?: boolean | undefined;
|
|
284
|
+
sourcePath?: string | undefined;
|
|
285
|
+
bypassPullRequestAllowances?: {
|
|
286
|
+
users?: string[];
|
|
287
|
+
teams?: string[];
|
|
288
|
+
apps?: string[];
|
|
289
|
+
} | undefined;
|
|
290
|
+
requiredApprovingReviewCount?: number | undefined;
|
|
291
|
+
restrictions?: {
|
|
292
|
+
users: string[];
|
|
293
|
+
teams: string[];
|
|
294
|
+
apps?: string[];
|
|
295
|
+
} | undefined;
|
|
296
|
+
requireCodeOwnerReviews?: boolean | undefined;
|
|
297
|
+
dismissStaleReviews?: boolean | undefined;
|
|
298
|
+
requiredStatusCheckContexts?: string[] | undefined;
|
|
299
|
+
requireBranchesToBeUpToDate?: boolean | undefined;
|
|
300
|
+
requiredConversationResolution?: boolean | undefined;
|
|
301
|
+
repoVisibility?: "internal" | "private" | "public" | undefined;
|
|
302
|
+
collaborators?: ({
|
|
303
|
+
user: string;
|
|
304
|
+
access: string;
|
|
305
|
+
} | {
|
|
306
|
+
team: string;
|
|
307
|
+
access: string;
|
|
308
|
+
} | {
|
|
309
|
+
/** @deprecated This field is deprecated in favor of team */
|
|
310
|
+
username: string;
|
|
311
|
+
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
|
|
312
|
+
})[] | undefined;
|
|
313
|
+
hasProjects?: boolean | undefined;
|
|
314
|
+
hasWiki?: boolean | undefined;
|
|
315
|
+
hasIssues?: boolean | undefined;
|
|
316
|
+
token?: string | undefined;
|
|
317
|
+
topics?: string[] | undefined;
|
|
318
|
+
repoVariables?: {
|
|
319
|
+
[key: string]: string;
|
|
320
|
+
} | undefined;
|
|
321
|
+
secrets?: {
|
|
322
|
+
[key: string]: string;
|
|
323
|
+
} | undefined;
|
|
324
|
+
requiredCommitSigning?: boolean | undefined;
|
|
325
|
+
}, _backstage_types.JsonObject>;
|
|
326
|
+
|
|
327
|
+
export { CreateGithubPullRequestActionOptions, createGithubActionsDispatchAction, createGithubDeployKeyAction, createGithubEnvironmentAction, createGithubIssuesLabelAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishGithubAction, createPublishGithubPullRequestAction };
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backstage/plugin-scaffolder-backend-module-github",
|
|
3
|
+
"description": "The github module for @backstage/plugin-scaffolder-backend",
|
|
4
|
+
"version": "0.1.0-next.0",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"main": "dist/index.cjs.js",
|
|
11
|
+
"types": "dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"backstage": {
|
|
14
|
+
"role": "backend-plugin-module"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"start": "backstage-cli package start",
|
|
18
|
+
"build": "backstage-cli package build",
|
|
19
|
+
"lint": "backstage-cli package lint",
|
|
20
|
+
"test": "backstage-cli package test",
|
|
21
|
+
"clean": "backstage-cli package clean",
|
|
22
|
+
"prepack": "backstage-cli package prepack",
|
|
23
|
+
"postpack": "backstage-cli package postpack"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@backstage/backend-common": "^0.20.0-next.3",
|
|
27
|
+
"@backstage/config": "^1.1.1",
|
|
28
|
+
"@backstage/errors": "^1.2.3",
|
|
29
|
+
"@backstage/integration": "^1.8.0-next.1",
|
|
30
|
+
"@backstage/plugin-scaffolder-node": "^0.2.9-next.3",
|
|
31
|
+
"@octokit/webhooks": "^10.0.0",
|
|
32
|
+
"libsodium-wrappers": "^0.7.11",
|
|
33
|
+
"octokit": "^2.0.0",
|
|
34
|
+
"octokit-plugin-create-pull-request": "^3.10.0",
|
|
35
|
+
"winston": "^3.2.1",
|
|
36
|
+
"yaml": "^2.0.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@backstage/backend-test-utils": "^0.2.9-next.3",
|
|
40
|
+
"@backstage/cli": "^0.25.0-next.3",
|
|
41
|
+
"@types/libsodium-wrappers": "^0.7.10",
|
|
42
|
+
"fs-extra": "10.1.0",
|
|
43
|
+
"jest-when": "^3.1.0",
|
|
44
|
+
"jsonschema": "^1.2.6"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist"
|
|
48
|
+
]
|
|
49
|
+
}
|