@backstage/plugin-scaffolder-backend-module-github 0.7.2-next.1 → 0.8.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 +100 -0
- package/dist/actions/github.cjs.js +45 -52
- package/dist/actions/github.cjs.js.map +1 -1
- package/dist/actions/githubActionsDispatch.cjs.js +15 -29
- package/dist/actions/githubActionsDispatch.cjs.js.map +1 -1
- package/dist/actions/githubAutolinks.cjs.js +15 -30
- package/dist/actions/githubAutolinks.cjs.js.map +1 -1
- package/dist/actions/githubBranchProtection.cjs.js +15 -23
- package/dist/actions/githubBranchProtection.cjs.js.map +1 -1
- package/dist/actions/githubDeployKey.cjs.js +21 -41
- package/dist/actions/githubDeployKey.cjs.js.map +1 -1
- package/dist/actions/githubEnvironment.cjs.js +47 -89
- package/dist/actions/githubEnvironment.cjs.js.map +1 -1
- package/dist/actions/githubIssuesLabel.cjs.js +12 -27
- package/dist/actions/githubIssuesLabel.cjs.js.map +1 -1
- package/dist/actions/githubPagesEnable.cjs.js +15 -34
- package/dist/actions/githubPagesEnable.cjs.js.map +1 -1
- package/dist/actions/githubPullRequest.cjs.js +66 -126
- package/dist/actions/githubPullRequest.cjs.js.map +1 -1
- package/dist/actions/githubRepoCreate.cjs.js +35 -42
- package/dist/actions/githubRepoCreate.cjs.js.map +1 -1
- package/dist/actions/githubRepoPush.cjs.js +23 -30
- package/dist/actions/githubRepoPush.cjs.js.map +1 -1
- package/dist/actions/githubWebhook.cjs.js +29 -63
- package/dist/actions/githubWebhook.cjs.js.map +1 -1
- package/dist/actions/inputProperties.cjs.js +145 -281
- package/dist/actions/inputProperties.cjs.js.map +1 -1
- package/dist/actions/outputProperties.cjs.js +9 -12
- package/dist/actions/outputProperties.cjs.js.map +1 -1
- package/dist/index.d.ts +210 -211
- package/dist/module.cjs.js +4 -9
- package/dist/module.cjs.js.map +1 -1
- package/package.json +14 -13
|
@@ -17,69 +17,35 @@ function createGithubWebhookAction(options) {
|
|
|
17
17
|
supportsDryRun: true,
|
|
18
18
|
schema: {
|
|
19
19
|
input: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
items: {
|
|
52
|
-
type: "string",
|
|
53
|
-
const: "*"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
|
-
active: {
|
|
59
|
-
title: "Active",
|
|
60
|
-
type: "boolean",
|
|
61
|
-
default: true,
|
|
62
|
-
description: "Determines if notifications are sent when the webhook is triggered. Default: `true`"
|
|
63
|
-
},
|
|
64
|
-
contentType: {
|
|
65
|
-
title: "Content Type",
|
|
66
|
-
type: "string",
|
|
67
|
-
enum: ["form", "json"],
|
|
68
|
-
default: "form",
|
|
69
|
-
description: "The media type used to serialize the payloads. The default is `form`"
|
|
70
|
-
},
|
|
71
|
-
insecureSsl: {
|
|
72
|
-
title: "Insecure SSL",
|
|
73
|
-
type: "boolean",
|
|
74
|
-
default: false,
|
|
75
|
-
description: "Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Default `false`"
|
|
76
|
-
},
|
|
77
|
-
token: {
|
|
78
|
-
title: "Authentication Token",
|
|
79
|
-
type: "string",
|
|
80
|
-
description: "The `GITHUB_TOKEN` to use for authorization to GitHub"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
20
|
+
repoUrl: (z) => z.string({
|
|
21
|
+
description: "Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username"
|
|
22
|
+
}),
|
|
23
|
+
webhookUrl: (z) => z.string({
|
|
24
|
+
description: "The URL to which the payloads will be delivered"
|
|
25
|
+
}),
|
|
26
|
+
webhookSecret: (z) => z.string({
|
|
27
|
+
description: "Webhook secret value. The default can be provided internally in action creation"
|
|
28
|
+
}).optional(),
|
|
29
|
+
events: (z) => z.union([
|
|
30
|
+
z.array(z.enum(eventNames), {
|
|
31
|
+
description: "Determines what events the hook is triggered for. Default: `[push]`"
|
|
32
|
+
}),
|
|
33
|
+
z.array(z.literal("*"), {
|
|
34
|
+
description: 'Determines what events the hook is triggered for. Use "*" for all events. Default: `[push]`'
|
|
35
|
+
})
|
|
36
|
+
]).default(["push"]).optional(),
|
|
37
|
+
active: (z) => z.boolean({
|
|
38
|
+
description: "Determines if notifications are sent when the webhook is triggered. Default: `true`"
|
|
39
|
+
}).default(true).optional(),
|
|
40
|
+
contentType: (z) => z.enum(["form", "json"], {
|
|
41
|
+
description: "The media type used to serialize the payloads. The default is `form`"
|
|
42
|
+
}).default("form").optional(),
|
|
43
|
+
insecureSsl: (z) => z.boolean({
|
|
44
|
+
description: "Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Default `false`"
|
|
45
|
+
}).default(false).optional(),
|
|
46
|
+
token: (z) => z.string({
|
|
47
|
+
description: "The `GITHUB_TOKEN` to use for authorization to GitHub"
|
|
48
|
+
}).optional()
|
|
83
49
|
}
|
|
84
50
|
},
|
|
85
51
|
async handler(ctx) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubWebhook.cjs.js","sources":["../../src/actions/githubWebhook.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n GithubCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { emitterEventNames } from '@octokit/webhooks';\nimport { assertError, InputError } from '@backstage/errors';\nimport { Octokit } from 'octokit';\nimport { getOctokitOptions } from '../util';\nimport { examples } from './githubWebhook.examples';\n\n/**\n * Creates new action that creates a webhook for a repository on GitHub.\n * @public\n */\nexport function createGithubWebhookAction(options: {\n integrations: ScmIntegrationRegistry;\n defaultWebhookSecret?: string;\n githubCredentialsProvider?: GithubCredentialsProvider;\n}) {\n const { integrations, defaultWebhookSecret, githubCredentialsProvider } =\n options;\n\n const eventNames = emitterEventNames.filter(event => !event.includes('.'));\n\n return createTemplateAction
|
|
1
|
+
{"version":3,"file":"githubWebhook.cjs.js","sources":["../../src/actions/githubWebhook.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n GithubCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { emitterEventNames } from '@octokit/webhooks';\nimport { assertError, InputError } from '@backstage/errors';\nimport { Octokit } from 'octokit';\nimport { getOctokitOptions } from '../util';\nimport { examples } from './githubWebhook.examples';\n\n/**\n * Creates new action that creates a webhook for a repository on GitHub.\n * @public\n */\nexport function createGithubWebhookAction(options: {\n integrations: ScmIntegrationRegistry;\n defaultWebhookSecret?: string;\n githubCredentialsProvider?: GithubCredentialsProvider;\n}) {\n const { integrations, defaultWebhookSecret, githubCredentialsProvider } =\n options;\n\n const eventNames = emitterEventNames.filter(event => !event.includes('.'));\n\n return createTemplateAction({\n id: 'github:webhook',\n description: 'Creates webhook for a repository on GitHub.',\n examples,\n supportsDryRun: true,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description:\n 'Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username',\n }),\n webhookUrl: z =>\n z.string({\n description: 'The URL to which the payloads will be delivered',\n }),\n webhookSecret: z =>\n z\n .string({\n description:\n 'Webhook secret value. The default can be provided internally in action creation',\n })\n .optional(),\n events: z =>\n z\n .union([\n z.array(z.enum(eventNames as [string, ...string[]]), {\n description:\n 'Determines what events the hook is triggered for. Default: `[push]`',\n }),\n z.array(z.literal('*'), {\n description:\n 'Determines what events the hook is triggered for. Use \"*\" for all events. Default: `[push]`',\n }),\n ])\n .default(['push'])\n .optional(),\n active: z =>\n z\n .boolean({\n description:\n 'Determines if notifications are sent when the webhook is triggered. Default: `true`',\n })\n .default(true)\n .optional(),\n contentType: z =>\n z\n .enum(['form', 'json'], {\n description:\n 'The media type used to serialize the payloads. The default is `form`',\n })\n .default('form')\n .optional(),\n insecureSsl: z =>\n z\n .boolean({\n description:\n 'Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Default `false`',\n })\n .default(false)\n .optional(),\n token: z =>\n z\n .string({\n description:\n 'The `GITHUB_TOKEN` to use for authorization to GitHub',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n webhookUrl,\n webhookSecret = defaultWebhookSecret,\n events = ['push'],\n active = true,\n contentType = 'form',\n insecureSsl = false,\n token: providedToken,\n } = ctx.input;\n\n ctx.logger.info(`Creating webhook ${webhookUrl} for repo ${repoUrl}`);\n const { host, owner, repo } = parseRepoUrl(repoUrl, integrations);\n\n if (!owner) {\n throw new InputError('Invalid repository owner provided in repoUrl');\n }\n\n const octokitOptions = await getOctokitOptions({\n integrations,\n credentialsProvider: githubCredentialsProvider,\n host,\n owner,\n repo,\n token: providedToken,\n });\n const client = new Octokit({\n ...octokitOptions,\n log: ctx.logger,\n });\n\n // If this is a dry run, log and return\n if (ctx.isDryRun) {\n ctx.logger.info(`Dry run complete`);\n return;\n }\n\n try {\n const insecure_ssl = insecureSsl ? '1' : '0';\n\n await ctx.checkpoint({\n key: `create.webhhook.${owner}.${repo}.${webhookUrl}`,\n fn: async () => {\n await client.rest.repos.createWebhook({\n owner,\n repo,\n config: {\n url: webhookUrl,\n content_type: contentType,\n secret: webhookSecret,\n insecure_ssl,\n },\n events,\n active,\n });\n },\n });\n\n ctx.logger.info(`Webhook '${webhookUrl}' created successfully`);\n } catch (e) {\n assertError(e);\n ctx.logger.warn(\n `Failed: create webhook '${webhookUrl}' on repo: '${repo}', ${e.message}`,\n );\n }\n },\n });\n}\n"],"names":["emitterEventNames","createTemplateAction","examples","parseRepoUrl","InputError","getOctokitOptions","Octokit","assertError"],"mappings":";;;;;;;;;AAkCO,SAAS,0BAA0B,OAIvC,EAAA;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,oBAAsB,EAAA,yBAAA,EAC1C,GAAA,OAAA;AAEF,EAAM,MAAA,UAAA,GAAaA,2BAAkB,MAAO,CAAA,CAAA,KAAA,KAAS,CAAC,KAAM,CAAA,QAAA,CAAS,GAAG,CAAC,CAAA;AAEzE,EAAA,OAAOC,yCAAqB,CAAA;AAAA,IAC1B,EAAI,EAAA,gBAAA;AAAA,IACJ,WAAa,EAAA,6CAAA;AAAA,cACbC,+BAAA;AAAA,IACA,cAAgB,EAAA,IAAA;AAAA,IAChB,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,OAAA,EAAS,CACP,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA,UACP,WACE,EAAA;A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AK,CAAA,KAAA,CAAM,aAAc,CAAA;AAAA,cACpC,KAAA;AAAA,cACA,IAAA;AAAA,cACA,MAAQ,EAAA;AAAA,gBACN,GAAK,EAAA,UAAA;AAAA,gBACL,YAAc,EAAA,WAAA;AAAA,gBACd,MAAQ,EAAA,aAAA;AAAA,gBACR;AAAA,eACF;AAAA,cACA,MAAA;AAAA,cACA;AAAA,aACD,CAAA;AAAA;AACH,SACD,CAAA;AAED,QAAA,GAAA,CAAI,MAAO,CAAA,IAAA,CAAK,CAAY,SAAA,EAAA,UAAU,CAAwB,sBAAA,CAAA,CAAA;AAAA,eACvD,CAAG,EAAA;AACV,QAAAC,kBAAA,CAAY,CAAC,CAAA;AACb,QAAA,GAAA,CAAI,MAAO,CAAA,IAAA;AAAA,UACT,2BAA2B,UAAU,CAAA,YAAA,EAAe,IAAI,CAAA,GAAA,EAAM,EAAE,OAAO,CAAA;AAAA,SACzE;AAAA;AACF;AACF,GACD,CAAA;AACH;;;;"}
|
|
@@ -1,315 +1,178 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const repoUrl = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
description: "
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const requiredStatusCheckContexts = {
|
|
32
|
-
title: "Required Status Check Contexts",
|
|
33
|
-
description: "The list of status checks to require in order to merge into this branch",
|
|
34
|
-
type: "array",
|
|
35
|
-
items: {
|
|
36
|
-
type: "string"
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const requireBranchesToBeUpToDate = {
|
|
40
|
-
title: "Require Branches To Be Up To Date?",
|
|
41
|
-
description: "Require branches to be up to date before merging. The default value is `true`",
|
|
42
|
-
type: "boolean",
|
|
43
|
-
default: true
|
|
44
|
-
};
|
|
45
|
-
const requiredConversationResolution = {
|
|
46
|
-
title: "Required Conversation Resolution",
|
|
47
|
-
description: "Requires all conversations on code to be resolved before a pull request can be merged into this branch",
|
|
48
|
-
type: "boolean"
|
|
49
|
-
};
|
|
50
|
-
const requireLastPushApproval = {
|
|
51
|
-
title: "Require last push approval",
|
|
52
|
-
type: "boolean",
|
|
53
|
-
default: false,
|
|
3
|
+
const repoUrl = (z) => z.string({
|
|
4
|
+
description: "Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username"
|
|
5
|
+
});
|
|
6
|
+
const description = (z) => z.string({
|
|
7
|
+
description: "Repository Description"
|
|
8
|
+
}).optional();
|
|
9
|
+
const homepage = (z) => z.string({
|
|
10
|
+
description: "Repository Homepage"
|
|
11
|
+
}).optional();
|
|
12
|
+
const access = (z) => z.string({
|
|
13
|
+
description: "Sets an admin collaborator on the repository. Can either be a user reference different from `owner` in `repoUrl` or team reference, eg. `org/team-name`"
|
|
14
|
+
}).optional();
|
|
15
|
+
const requireCodeOwnerReviews = (z) => z.boolean({
|
|
16
|
+
description: "Require an approved review in PR including files with a designated Code Owner"
|
|
17
|
+
}).optional();
|
|
18
|
+
const dismissStaleReviews = (z) => z.boolean({
|
|
19
|
+
description: "New reviewable commits pushed to a matching branch will dismiss pull request review approvals."
|
|
20
|
+
}).optional();
|
|
21
|
+
const requiredStatusCheckContexts = (z) => z.array(z.string(), {
|
|
22
|
+
description: "The list of status checks to require in order to merge into this branch"
|
|
23
|
+
}).optional();
|
|
24
|
+
const requireBranchesToBeUpToDate = (z) => z.boolean({
|
|
25
|
+
description: "Require branches to be up to date before merging. The default value is `true`"
|
|
26
|
+
}).default(true).optional();
|
|
27
|
+
const requiredConversationResolution = (z) => z.boolean({
|
|
28
|
+
description: "Requires all conversations on code to be resolved before a pull request can be merged into this branch"
|
|
29
|
+
}).optional();
|
|
30
|
+
const requireLastPushApproval = (z) => z.boolean({
|
|
54
31
|
description: "Whether the most recent push to a PR must be approved by someone other than the person who pushed it. The default value is `false`"
|
|
55
|
-
};
|
|
56
|
-
const repoVisibility = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
const deleteBranchOnMerge = {
|
|
62
|
-
title: "Delete Branch On Merge",
|
|
63
|
-
type: "boolean",
|
|
64
|
-
default: false,
|
|
32
|
+
}).default(false).optional();
|
|
33
|
+
const repoVisibility = (z) => z.enum(["private", "public", "internal"], {
|
|
34
|
+
description: "Repository Visibility"
|
|
35
|
+
}).optional();
|
|
36
|
+
const deleteBranchOnMerge = (z) => z.boolean({
|
|
65
37
|
description: "Delete the branch after merging the PR. The default value is `false`"
|
|
66
|
-
};
|
|
67
|
-
const gitAuthorName = {
|
|
68
|
-
title: "Default Author Name",
|
|
69
|
-
type: "string",
|
|
70
|
-
default: "Scaffolder",
|
|
38
|
+
}).default(false).optional();
|
|
39
|
+
const gitAuthorName = (z) => z.string({
|
|
71
40
|
description: "Sets the default author name for the commit. The default value is `Scaffolder`"
|
|
72
|
-
};
|
|
73
|
-
const gitAuthorEmail = {
|
|
74
|
-
title: "Default Author Email",
|
|
75
|
-
type: "string",
|
|
41
|
+
}).default("Scaffolder").optional();
|
|
42
|
+
const gitAuthorEmail = (z) => z.string({
|
|
76
43
|
description: `Sets the default author email for the commit.`
|
|
77
|
-
};
|
|
78
|
-
const allowMergeCommit = {
|
|
79
|
-
title: "Allow Merge Commits",
|
|
80
|
-
type: "boolean",
|
|
81
|
-
default: true,
|
|
44
|
+
}).optional();
|
|
45
|
+
const allowMergeCommit = (z) => z.boolean({
|
|
82
46
|
description: "Allow merge commits. The default value is `true`"
|
|
83
|
-
};
|
|
84
|
-
const allowSquashMerge = {
|
|
85
|
-
title: "Allow Squash Merges",
|
|
86
|
-
type: "boolean",
|
|
87
|
-
default: true,
|
|
47
|
+
}).default(true).optional();
|
|
48
|
+
const allowSquashMerge = (z) => z.boolean({
|
|
88
49
|
description: "Allow squash merges. The default value is `true`"
|
|
89
|
-
};
|
|
90
|
-
const allowUpdateBranch = {
|
|
91
|
-
title: "Allow Update Branch",
|
|
92
|
-
type: "boolean",
|
|
93
|
-
default: false,
|
|
50
|
+
}).default(true).optional();
|
|
51
|
+
const allowUpdateBranch = (z) => z.boolean({
|
|
94
52
|
description: "Allow branch to be updated. The default value is `false`"
|
|
95
|
-
};
|
|
96
|
-
const squashMergeCommitTitle = {
|
|
97
|
-
title: "Default squash merge commit title",
|
|
98
|
-
enum: ["PR_TITLE", "COMMIT_OR_PR_TITLE"],
|
|
99
|
-
type: "string",
|
|
100
|
-
default: "COMMIT_OR_PR_TITLE",
|
|
53
|
+
}).default(false).optional();
|
|
54
|
+
const squashMergeCommitTitle = (z) => z.enum(["PR_TITLE", "COMMIT_OR_PR_TITLE"], {
|
|
101
55
|
description: "Sets the default value for a squash merge commit title. The default value is `COMMIT_OR_PR_TITLE`"
|
|
102
|
-
};
|
|
103
|
-
const squashMergeCommitMessage = {
|
|
104
|
-
title: "Default squash merge commit message",
|
|
105
|
-
enum: ["PR_BODY", "COMMIT_MESSAGES", "BLANK"],
|
|
106
|
-
type: "string",
|
|
107
|
-
default: "COMMIT_MESSAGES",
|
|
56
|
+
}).default("COMMIT_OR_PR_TITLE").optional();
|
|
57
|
+
const squashMergeCommitMessage = (z) => z.enum(["PR_BODY", "COMMIT_MESSAGES", "BLANK"], {
|
|
108
58
|
description: "Sets the default value for a squash merge commit message. The default value is `COMMIT_MESSAGES`"
|
|
109
|
-
};
|
|
110
|
-
const allowRebaseMerge = {
|
|
111
|
-
title: "Allow Rebase Merges",
|
|
112
|
-
type: "boolean",
|
|
113
|
-
default: true,
|
|
59
|
+
}).default("COMMIT_MESSAGES").optional();
|
|
60
|
+
const allowRebaseMerge = (z) => z.boolean({
|
|
114
61
|
description: "Allow rebase merges. The default value is `true`"
|
|
115
|
-
};
|
|
116
|
-
const allowAutoMerge = {
|
|
117
|
-
title: "Allow Auto Merges",
|
|
118
|
-
type: "boolean",
|
|
119
|
-
default: false,
|
|
62
|
+
}).default(true).optional();
|
|
63
|
+
const allowAutoMerge = (z) => z.boolean({
|
|
120
64
|
description: "Allow individual PRs to merge automatically when all merge requirements are met. The default value is `false`"
|
|
121
|
-
};
|
|
122
|
-
const collaborators =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
items: {
|
|
127
|
-
type: "object",
|
|
128
|
-
additionalProperties: false,
|
|
129
|
-
required: ["access"],
|
|
130
|
-
properties: {
|
|
131
|
-
access: {
|
|
132
|
-
type: "string",
|
|
65
|
+
}).default(false).optional();
|
|
66
|
+
const collaborators = (z) => z.array(
|
|
67
|
+
z.union([
|
|
68
|
+
z.object({
|
|
69
|
+
access: z.string({
|
|
133
70
|
description: "The type of access for the user"
|
|
134
|
-
},
|
|
135
|
-
user: {
|
|
136
|
-
type: "string",
|
|
71
|
+
}),
|
|
72
|
+
user: z.string({
|
|
137
73
|
description: "The name of the user that will be added as a collaborator"
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
74
|
+
})
|
|
75
|
+
}),
|
|
76
|
+
z.object({
|
|
77
|
+
access: z.string({
|
|
78
|
+
description: "The type of access for the team"
|
|
79
|
+
}),
|
|
80
|
+
team: z.string({
|
|
141
81
|
description: "The name of the team that will be added as a collaborator"
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
]),
|
|
85
|
+
{
|
|
86
|
+
description: "Provide additional users or teams with permissions"
|
|
145
87
|
}
|
|
146
|
-
|
|
147
|
-
const hasProjects = {
|
|
148
|
-
title: "Enable projects",
|
|
149
|
-
type: "boolean",
|
|
88
|
+
).optional();
|
|
89
|
+
const hasProjects = (z) => z.boolean({
|
|
150
90
|
description: "Enable projects for the repository. The default value is `true` unless the organization has disabled repository projects"
|
|
151
|
-
};
|
|
152
|
-
const hasWiki = {
|
|
153
|
-
title: "Enable the wiki",
|
|
154
|
-
type: "boolean",
|
|
155
|
-
default: true,
|
|
91
|
+
}).optional();
|
|
92
|
+
const hasWiki = (z) => z.boolean({
|
|
156
93
|
description: "Enable the wiki for the repository. The default value is `true`"
|
|
157
|
-
};
|
|
158
|
-
const hasIssues = {
|
|
159
|
-
title: "Enable issues",
|
|
160
|
-
type: "boolean",
|
|
161
|
-
default: true,
|
|
94
|
+
}).default(true).optional();
|
|
95
|
+
const hasIssues = (z) => z.boolean({
|
|
162
96
|
description: "Enable issues for the repository. The default value is `true`"
|
|
163
|
-
};
|
|
164
|
-
const token = {
|
|
165
|
-
title: "Authentication Token",
|
|
166
|
-
type: "string",
|
|
97
|
+
}).default(true).optional();
|
|
98
|
+
const token = (z) => z.string({
|
|
167
99
|
description: "The token to use for authorization to GitHub"
|
|
168
|
-
};
|
|
169
|
-
const topics = {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const defaultBranch = {
|
|
177
|
-
title: "Default Branch",
|
|
178
|
-
type: "string",
|
|
179
|
-
default: "master",
|
|
180
|
-
description: "Sets the default branch on the repository. The default value is `master`"
|
|
181
|
-
};
|
|
182
|
-
const protectDefaultBranch = {
|
|
183
|
-
title: "Protect Default Branch",
|
|
184
|
-
type: "boolean",
|
|
185
|
-
default: true,
|
|
100
|
+
}).optional();
|
|
101
|
+
const topics = (z) => z.array(z.string(), {
|
|
102
|
+
description: "Adds topics to the repository"
|
|
103
|
+
}).optional();
|
|
104
|
+
const defaultBranch = (z) => z.string({
|
|
105
|
+
description: `Sets the default branch on the repository. The default value is 'master'`
|
|
106
|
+
}).default("master").optional();
|
|
107
|
+
const protectDefaultBranch = (z) => z.boolean({
|
|
186
108
|
description: "Protect the default branch after creating the repository. The default value is `true`"
|
|
187
|
-
};
|
|
188
|
-
const protectEnforceAdmins = {
|
|
189
|
-
title: "Enforce Admins On Protected Branches",
|
|
190
|
-
type: "boolean",
|
|
191
|
-
default: true,
|
|
109
|
+
}).default(true).optional();
|
|
110
|
+
const protectEnforceAdmins = (z) => z.boolean({
|
|
192
111
|
description: "Enforce admins to adhere to default branch protection. The default value is `true`"
|
|
193
|
-
};
|
|
194
|
-
const bypassPullRequestAllowances =
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
items: {
|
|
203
|
-
type: "string"
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
users: {
|
|
207
|
-
type: "array",
|
|
208
|
-
items: {
|
|
209
|
-
type: "string"
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
teams: {
|
|
213
|
-
type: "array",
|
|
214
|
-
items: {
|
|
215
|
-
type: "string"
|
|
216
|
-
}
|
|
217
|
-
}
|
|
112
|
+
}).default(true).optional();
|
|
113
|
+
const bypassPullRequestAllowances = (z) => z.object(
|
|
114
|
+
{
|
|
115
|
+
apps: z.array(z.string()).optional(),
|
|
116
|
+
users: z.array(z.string()).optional(),
|
|
117
|
+
teams: z.array(z.string()).optional()
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
description: "Allow specific users, teams, or apps to bypass pull request requirements."
|
|
218
121
|
}
|
|
219
|
-
|
|
220
|
-
const gitCommitMessage = {
|
|
221
|
-
title: "Git Commit Message",
|
|
222
|
-
type: "string",
|
|
223
|
-
default: "initial commit",
|
|
122
|
+
).optional();
|
|
123
|
+
const gitCommitMessage = (z) => z.string({
|
|
224
124
|
description: "Sets the commit message on the repository. The default value is `initial commit`"
|
|
225
|
-
};
|
|
226
|
-
const sourcePath = {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
};
|
|
231
|
-
const requiredApprovingReviewCount = {
|
|
232
|
-
title: "Required approving review count",
|
|
233
|
-
type: "number",
|
|
125
|
+
}).default("initial commit").optional();
|
|
126
|
+
const sourcePath = (z) => z.string({
|
|
127
|
+
description: "Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository."
|
|
128
|
+
}).optional();
|
|
129
|
+
const requiredApprovingReviewCount = (z) => z.number({
|
|
234
130
|
description: "Specify the number of reviewers required to approve pull requests. Use a number between `1` and `6` or `0` to not require reviewers. Defaults to `1`."
|
|
235
|
-
};
|
|
236
|
-
const restrictions =
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
items: {
|
|
245
|
-
type: "string"
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
users: {
|
|
249
|
-
type: "array",
|
|
250
|
-
items: {
|
|
251
|
-
type: "string"
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
teams: {
|
|
255
|
-
type: "array",
|
|
256
|
-
items: {
|
|
257
|
-
type: "string"
|
|
258
|
-
}
|
|
259
|
-
}
|
|
131
|
+
}).optional();
|
|
132
|
+
const restrictions = (z) => z.object(
|
|
133
|
+
{
|
|
134
|
+
apps: z.array(z.string()).optional(),
|
|
135
|
+
users: z.array(z.string()),
|
|
136
|
+
teams: z.array(z.string())
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
description: "Restrict who can push to the protected branch. User, app, and team restrictions are only available for organization-owned repositories."
|
|
260
140
|
}
|
|
261
|
-
|
|
262
|
-
const requiredCommitSigning = {
|
|
263
|
-
title: "Require commit signing",
|
|
264
|
-
type: "boolean",
|
|
141
|
+
).optional();
|
|
142
|
+
const requiredCommitSigning = (z) => z.boolean({
|
|
265
143
|
description: `Require commit signing so that you must sign commits on this branch.`
|
|
266
|
-
};
|
|
267
|
-
const requiredLinearHistory = {
|
|
268
|
-
title: "Require linear history",
|
|
269
|
-
type: "boolean",
|
|
144
|
+
}).optional();
|
|
145
|
+
const requiredLinearHistory = (z) => z.boolean({
|
|
270
146
|
description: `Prevent merge commits from being pushed to matching branches.`
|
|
271
|
-
};
|
|
272
|
-
const repoVariables = {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
description: `OIDC customization template attached to the repository.`,
|
|
285
|
-
type: "object",
|
|
286
|
-
additionalProperties: false,
|
|
287
|
-
properties: {
|
|
288
|
-
useDefault: {
|
|
289
|
-
title: "Use Default",
|
|
290
|
-
type: "boolean",
|
|
291
|
-
description: `Whether to use the default OIDC template or not.`
|
|
292
|
-
},
|
|
293
|
-
includeClaimKeys: {
|
|
294
|
-
title: "Include claim keys",
|
|
295
|
-
type: "array",
|
|
296
|
-
items: {
|
|
297
|
-
type: "string"
|
|
298
|
-
},
|
|
147
|
+
}).optional();
|
|
148
|
+
const repoVariables = (z) => z.record(z.string(), {
|
|
149
|
+
description: "Variables attached to the repository"
|
|
150
|
+
}).optional();
|
|
151
|
+
const secrets = (z) => z.record(z.string(), {
|
|
152
|
+
description: "Secrets attached to the repository"
|
|
153
|
+
}).optional();
|
|
154
|
+
const oidcCustomization = (z) => z.object(
|
|
155
|
+
{
|
|
156
|
+
useDefault: z.boolean({
|
|
157
|
+
description: `Whether to use the default template or not. If true, includeClaimKeys must not be set.`
|
|
158
|
+
}).default(true),
|
|
159
|
+
includeClaimKeys: z.array(z.string(), {
|
|
299
160
|
description: `Array of unique strings. Each claim key can only contain alphanumeric characters and underscores.`
|
|
300
|
-
}
|
|
161
|
+
}).optional()
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
description: `OIDC customization template attached to the repository.`
|
|
301
165
|
}
|
|
302
|
-
|
|
303
|
-
const customProperties = {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
description: `
|
|
311
|
-
|
|
312
|
-
};
|
|
166
|
+
).optional();
|
|
167
|
+
const customProperties = (z) => z.record(z.string(), {
|
|
168
|
+
description: "Custom properties to be added to the repository (note, this only works for organization repositories)"
|
|
169
|
+
}).optional();
|
|
170
|
+
const subscribe = (z) => z.boolean({
|
|
171
|
+
description: `Subscribe to the repository. The default value is 'false'`
|
|
172
|
+
}).optional();
|
|
173
|
+
const branch = (z) => z.string({
|
|
174
|
+
description: `The branch to protect. Defaults to the repository's default branch`
|
|
175
|
+
}).optional();
|
|
313
176
|
|
|
314
177
|
exports.access = access;
|
|
315
178
|
exports.allowAutoMerge = allowAutoMerge;
|
|
@@ -317,6 +180,7 @@ exports.allowMergeCommit = allowMergeCommit;
|
|
|
317
180
|
exports.allowRebaseMerge = allowRebaseMerge;
|
|
318
181
|
exports.allowSquashMerge = allowSquashMerge;
|
|
319
182
|
exports.allowUpdateBranch = allowUpdateBranch;
|
|
183
|
+
exports.branch = branch;
|
|
320
184
|
exports.bypassPullRequestAllowances = bypassPullRequestAllowances;
|
|
321
185
|
exports.collaborators = collaborators;
|
|
322
186
|
exports.customProperties = customProperties;
|