@backstage/plugin-scaffolder-backend-module-github 0.10.3 → 0.10.4
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 +39 -2
- package/README.md +19 -0
- package/dist/actions/githubRulesets.cjs.js +120 -0
- package/dist/actions/githubRulesets.cjs.js.map +1 -0
- package/dist/actions/githubRulesets.examples.cjs.js +127 -0
- package/dist/actions/githubRulesets.examples.cjs.js.map +1 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +35 -1
- package/dist/module.cjs.js +6 -0
- package/dist/module.cjs.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,47 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend-module-github
|
|
2
2
|
|
|
3
|
-
## 0.10.
|
|
3
|
+
## 0.10.4
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 24de596: Bumped the version to account for a patch release from an older release line, so that `^` ranges resolve to this release.
|
|
8
|
+
|
|
9
|
+
## 0.10.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 1368ad3: Added a `github:repo:rulesets:create` action that creates a ruleset in a GitHub repository. Rules and bypass actors are written in the same format as the GitHub REST API, so any rule type that GitHub supports can be used in templates.
|
|
14
|
+
- 6c43d4f: Validates the `targetPath` input of the `gitlab:repo:push`, `publish:gitlab:merge-request` and `publish:github:pull-request` scaffolder actions, and the `filesToDelete` entries of `publish:github:pull-request`. The values must be relative paths within the target repository; absolute paths and paths containing `..` segments are now rejected, so changes are only applied inside the intended subdirectory of the repository.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- @backstage/integration@2.2.0
|
|
17
|
+
- @backstage/backend-plugin-api@1.12.0
|
|
18
|
+
- @backstage/errors@1.4.0
|
|
19
|
+
- @backstage/catalog-model@1.10.3
|
|
20
|
+
- @backstage/config@1.3.11
|
|
21
|
+
- @backstage/plugin-catalog-node@3.0.0
|
|
22
|
+
- @backstage/plugin-scaffolder-node@1.0.0
|
|
23
|
+
|
|
24
|
+
## 0.10.2-next.1
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
- @backstage/backend-plugin-api@1.12.0-next.1
|
|
30
|
+
- @backstage/errors@1.4.0-next.0
|
|
31
|
+
- @backstage/integration@2.1.4-next.0
|
|
32
|
+
- @backstage/plugin-catalog-node@3.0.0-next.2
|
|
33
|
+
- @backstage/plugin-scaffolder-node@1.0.0-next.2
|
|
34
|
+
- @backstage/catalog-model@1.10.3-next.0
|
|
35
|
+
- @backstage/config@1.3.11-next.0
|
|
36
|
+
|
|
37
|
+
## 0.10.2-next.0
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies
|
|
42
|
+
- @backstage/backend-plugin-api@1.11.1-next.0
|
|
43
|
+
- @backstage/plugin-catalog-node@2.2.7-next.0
|
|
44
|
+
- @backstage/plugin-scaffolder-node@0.13.9-next.0
|
|
8
45
|
|
|
9
46
|
## 0.10.1
|
|
10
47
|
|
package/README.md
CHANGED
|
@@ -3,3 +3,22 @@
|
|
|
3
3
|
The github module for [@backstage/plugin-scaffolder-backend](https://www.npmjs.com/package/@backstage/plugin-scaffolder-backend).
|
|
4
4
|
|
|
5
5
|
_This plugin was created through the Backstage CLI_
|
|
6
|
+
|
|
7
|
+
## Actions
|
|
8
|
+
|
|
9
|
+
- `publish:github`
|
|
10
|
+
- `publish:github:pull-request`
|
|
11
|
+
- `github:actions:dispatch`
|
|
12
|
+
- `github:autolinks:create`
|
|
13
|
+
- `github:branch-protection:create`
|
|
14
|
+
- `github:deployKey:create`
|
|
15
|
+
- `github:environment:create`
|
|
16
|
+
- `github:issues:create`
|
|
17
|
+
- `github:issues:label`
|
|
18
|
+
- `github:pages:enable`
|
|
19
|
+
- `github:repo:create`
|
|
20
|
+
- `github:repo:push`
|
|
21
|
+
- `github:repo:rulesets:create`
|
|
22
|
+
- `github:webhook`
|
|
23
|
+
|
|
24
|
+
Each action's inputs and examples are listed in your Backstage instance at `/create/actions`.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var errors = require('@backstage/errors');
|
|
4
|
+
var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
|
|
5
|
+
var octokit = require('octokit');
|
|
6
|
+
var githubRulesets_examples = require('./githubRulesets.examples.cjs.js');
|
|
7
|
+
var util = require('../util.cjs.js');
|
|
8
|
+
|
|
9
|
+
function createGithubRepoRulesetsCreateAction(options) {
|
|
10
|
+
const { integrations, githubCredentialsProvider, requireScmUserCredentials } = options;
|
|
11
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
12
|
+
id: "github:repo:rulesets:create",
|
|
13
|
+
description: "Creates a ruleset in a GitHub repository.",
|
|
14
|
+
examples: githubRulesets_examples.examples,
|
|
15
|
+
schema: {
|
|
16
|
+
input: {
|
|
17
|
+
repoUrl: (z) => z.string({
|
|
18
|
+
description: "Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the repository name and `owner` is an organization or username"
|
|
19
|
+
}),
|
|
20
|
+
name: (z) => z.string({
|
|
21
|
+
description: "The name of the ruleset"
|
|
22
|
+
}),
|
|
23
|
+
target: (z) => z.enum(["branch", "tag"], {
|
|
24
|
+
description: "The target of the ruleset - `branch` or `tag`. Default is `branch`"
|
|
25
|
+
}).default("branch"),
|
|
26
|
+
enforcement: (z) => z.enum(["active", "evaluate", "disabled"], {
|
|
27
|
+
description: "The enforcement level of the ruleset - `active`, `evaluate` or `disabled`. Default is `active`. `evaluate` is not available on all GitHub plans, see https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets"
|
|
28
|
+
}).default("active"),
|
|
29
|
+
conditions: (z) => z.object(
|
|
30
|
+
{
|
|
31
|
+
ref_name: z.object({
|
|
32
|
+
include: z.array(z.string()).optional(),
|
|
33
|
+
exclude: z.array(z.string()).optional()
|
|
34
|
+
}).optional()
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
description: "The conditions that determine which refs the ruleset applies to. Ref name patterns also accept `~DEFAULT_BRANCH` and `~ALL`. Without conditions, the ruleset applies to no refs"
|
|
38
|
+
}
|
|
39
|
+
).optional(),
|
|
40
|
+
rules: (z) => z.array(
|
|
41
|
+
z.object({
|
|
42
|
+
type: z.string(),
|
|
43
|
+
parameters: z.record(z.string(), z.any()).optional()
|
|
44
|
+
}),
|
|
45
|
+
{
|
|
46
|
+
description: "The rules to enforce, in the format of the GitHub REST API, for example `{ type: pull_request, parameters: { ... } }`"
|
|
47
|
+
}
|
|
48
|
+
).optional(),
|
|
49
|
+
bypassActors: (z) => z.array(
|
|
50
|
+
z.object({
|
|
51
|
+
actor_id: z.number().int().nullable().optional(),
|
|
52
|
+
actor_type: z.string(),
|
|
53
|
+
bypass_mode: z.enum(["always", "pull_request", "exempt"]).optional()
|
|
54
|
+
}),
|
|
55
|
+
{
|
|
56
|
+
description: "The actors that can bypass the ruleset, in the format of the GitHub REST API"
|
|
57
|
+
}
|
|
58
|
+
).optional(),
|
|
59
|
+
token: (z) => z.string({
|
|
60
|
+
description: "The token to use for authorization to GitHub"
|
|
61
|
+
}).optional()
|
|
62
|
+
},
|
|
63
|
+
output: {
|
|
64
|
+
id: (z) => z.number({
|
|
65
|
+
description: "The ID of the created ruleset"
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
async handler(ctx) {
|
|
70
|
+
const {
|
|
71
|
+
repoUrl,
|
|
72
|
+
name,
|
|
73
|
+
target = "branch",
|
|
74
|
+
enforcement = "active",
|
|
75
|
+
conditions,
|
|
76
|
+
rules,
|
|
77
|
+
bypassActors,
|
|
78
|
+
token: providedToken
|
|
79
|
+
} = ctx.input;
|
|
80
|
+
const { host, owner, repo } = pluginScaffolderNode.parseRepoUrl(repoUrl, integrations);
|
|
81
|
+
if (!owner) {
|
|
82
|
+
throw new errors.InputError(`No owner provided for repo ${repoUrl}`);
|
|
83
|
+
}
|
|
84
|
+
const octokitOptions = await util.getOctokitOptions({
|
|
85
|
+
integrations,
|
|
86
|
+
requireScmUserCredentials,
|
|
87
|
+
credentialsProvider: githubCredentialsProvider,
|
|
88
|
+
token: providedToken,
|
|
89
|
+
host,
|
|
90
|
+
owner,
|
|
91
|
+
repo
|
|
92
|
+
});
|
|
93
|
+
const client = new octokit.Octokit({
|
|
94
|
+
...octokitOptions,
|
|
95
|
+
log: ctx.logger
|
|
96
|
+
});
|
|
97
|
+
ctx.logger.info(`Creating ruleset "${name}" in ${owner}/${repo}`);
|
|
98
|
+
const id = await ctx.checkpoint({
|
|
99
|
+
key: `create.ruleset.${JSON.stringify([host, owner, repo, name])}`,
|
|
100
|
+
fn: async () => {
|
|
101
|
+
const { data } = await client.rest.repos.createRepoRuleset({
|
|
102
|
+
owner,
|
|
103
|
+
repo,
|
|
104
|
+
name,
|
|
105
|
+
target,
|
|
106
|
+
enforcement,
|
|
107
|
+
conditions,
|
|
108
|
+
rules,
|
|
109
|
+
bypass_actors: bypassActors
|
|
110
|
+
});
|
|
111
|
+
return data.id;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
ctx.output("id", id);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
exports.createGithubRepoRulesetsCreateAction = createGithubRepoRulesetsCreateAction;
|
|
120
|
+
//# sourceMappingURL=githubRulesets.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"githubRulesets.cjs.js","sources":["../../src/actions/githubRulesets.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { InputError } from '@backstage/errors';\nimport {\n GithubCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { Octokit } from 'octokit';\nimport { examples } from './githubRulesets.examples';\nimport { getOctokitOptions } from '../util';\n\ntype CreateRepoRulesetParameters = Parameters<\n Octokit['rest']['repos']['createRepoRuleset']\n>[0] & {};\n\n/**\n * Creates a `github:repo:rulesets:create` Scaffolder action that creates a ruleset in a GitHub repository.\n *\n * @public\n */\nexport function createGithubRepoRulesetsCreateAction(options: {\n integrations: ScmIntegrationRegistry;\n githubCredentialsProvider?: GithubCredentialsProvider;\n requireScmUserCredentials?: boolean;\n}) {\n const { integrations, githubCredentialsProvider, requireScmUserCredentials } =\n options;\n\n return createTemplateAction({\n id: 'github:repo:rulesets:create',\n description: 'Creates a ruleset in a GitHub repository.',\n examples,\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 repository name and `owner` is an organization or username',\n }),\n name: z =>\n z.string({\n description: 'The name of the ruleset',\n }),\n target: z =>\n z\n .enum(['branch', 'tag'], {\n description:\n 'The target of the ruleset - `branch` or `tag`. Default is `branch`',\n })\n .default('branch'),\n enforcement: z =>\n z\n .enum(['active', 'evaluate', 'disabled'], {\n description:\n 'The enforcement level of the ruleset - `active`, `evaluate` or `disabled`. Default is `active`. `evaluate` is not available on all GitHub plans, see https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets',\n })\n .default('active'),\n conditions: z =>\n z\n .object(\n {\n ref_name: z\n .object({\n include: z.array(z.string()).optional(),\n exclude: z.array(z.string()).optional(),\n })\n .optional(),\n },\n {\n description:\n 'The conditions that determine which refs the ruleset applies to. Ref name patterns also accept `~DEFAULT_BRANCH` and `~ALL`. Without conditions, the ruleset applies to no refs',\n },\n )\n .optional(),\n rules: z =>\n z\n .array(\n z.object({\n type: z.string(),\n parameters: z.record(z.string(), z.any()).optional(),\n }),\n {\n description:\n 'The rules to enforce, in the format of the GitHub REST API, for example `{ type: pull_request, parameters: { ... } }`',\n },\n )\n .optional(),\n bypassActors: z =>\n z\n .array(\n z.object({\n actor_id: z.number().int().nullable().optional(),\n actor_type: z.string(),\n bypass_mode: z\n .enum(['always', 'pull_request', 'exempt'])\n .optional(),\n }),\n {\n description:\n 'The actors that can bypass the ruleset, in the format of the GitHub REST API',\n },\n )\n .optional(),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitHub',\n })\n .optional(),\n },\n output: {\n id: z =>\n z.number({\n description: 'The ID of the created ruleset',\n }),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n name,\n target = 'branch',\n enforcement = 'active',\n conditions,\n rules,\n bypassActors,\n token: providedToken,\n } = ctx.input;\n\n const { host, owner, repo } = parseRepoUrl(repoUrl, integrations);\n\n if (!owner) {\n throw new InputError(`No owner provided for repo ${repoUrl}`);\n }\n\n const octokitOptions = await getOctokitOptions({\n integrations,\n requireScmUserCredentials,\n credentialsProvider: githubCredentialsProvider,\n token: providedToken,\n host,\n owner,\n repo,\n });\n const client = new Octokit({\n ...octokitOptions,\n log: ctx.logger,\n });\n\n ctx.logger.info(`Creating ruleset \"${name}\" in ${owner}/${repo}`);\n\n const id = await ctx.checkpoint({\n key: `create.ruleset.${JSON.stringify([host, owner, repo, name])}`,\n fn: async () => {\n const { data } = await client.rest.repos.createRepoRuleset({\n owner,\n repo,\n name,\n target,\n enforcement,\n conditions,\n rules: rules as CreateRepoRulesetParameters['rules'],\n bypass_actors:\n bypassActors as CreateRepoRulesetParameters['bypass_actors'],\n });\n return data.id;\n },\n });\n\n ctx.output('id', id);\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","getOctokitOptions","Octokit"],"mappings":";;;;;;;;AAsCO,SAAS,qCAAqC,OAAA,EAIlD;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,yBAAA,EAA2B,yBAAA,EAA0B,GACzE,OAAA;AAEF,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,6BAAA;AAAA,IACJ,WAAA,EAAa,2CAAA;AAAA,cACbC,gCAAA;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO;AAAA,QACL,OAAA,EAAS,CAAA,CAAA,KACP,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EACE;AAAA,SACH,CAAA;AAAA,QACH,IAAA,EAAM,CAAA,CAAA,KACJ,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa;AAAA,SACd,CAAA;AAAA,QACH,QAAQ,CAAA,CAAA,KACN,CAAA,CACG,KAAK,CAAC,QAAA,EAAU,KAAK,CAAA,EAAG;AAAA,UACvB,WAAA,EACE;AAAA,SACH,CAAA,CACA,OAAA,CAAQ,QAAQ,CAAA;AAAA,QACrB,WAAA,EAAa,OACX,CAAA,CACG,IAAA,CAAK,CAAC,QAAA,EAAU,UAAA,EAAY,UAAU,CAAA,EAAG;AAAA,UACxC,WAAA,EACE;AAAA,SACH,CAAA,CACA,OAAA,CAAQ,QAAQ,CAAA;AAAA,QACrB,UAAA,EAAY,OACV,CAAA,CACG,MAAA;AAAA,UACC;AAAA,YACE,QAAA,EAAU,EACP,MAAA,CAAO;AAAA,cACN,SAAS,CAAA,CAAE,KAAA,CAAM,EAAE,MAAA,EAAQ,EAAE,QAAA,EAAS;AAAA,cACtC,SAAS,CAAA,CAAE,KAAA,CAAM,EAAE,MAAA,EAAQ,EAAE,QAAA;AAAS,aACvC,EACA,QAAA;AAAS,WACd;AAAA,UACA;AAAA,YACE,WAAA,EACE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,MAAM,EAAE,CAAA;AAAA,IACrB;AAAA,GACD,CAAA;AACH;;"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var yaml = require('yaml');
|
|
4
|
+
|
|
5
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
6
|
+
|
|
7
|
+
var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
|
|
8
|
+
|
|
9
|
+
const examples = [
|
|
10
|
+
{
|
|
11
|
+
description: `Require a pull request with one approval and passing status checks on the repository's default branch.`,
|
|
12
|
+
example: yaml__default.default.stringify({
|
|
13
|
+
steps: [
|
|
14
|
+
{
|
|
15
|
+
action: "github:repo:rulesets:create",
|
|
16
|
+
name: "Protect default branch",
|
|
17
|
+
input: {
|
|
18
|
+
repoUrl: "github.com?repo=repo&owner=owner",
|
|
19
|
+
name: "default-branch",
|
|
20
|
+
conditions: {
|
|
21
|
+
ref_name: {
|
|
22
|
+
include: ["~DEFAULT_BRANCH"],
|
|
23
|
+
exclude: []
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
rules: [
|
|
27
|
+
{ type: "deletion" },
|
|
28
|
+
{ type: "non_fast_forward" },
|
|
29
|
+
{
|
|
30
|
+
type: "pull_request",
|
|
31
|
+
parameters: {
|
|
32
|
+
required_approving_review_count: 1,
|
|
33
|
+
dismiss_stale_reviews_on_push: true,
|
|
34
|
+
require_code_owner_review: false,
|
|
35
|
+
require_last_push_approval: false,
|
|
36
|
+
required_review_thread_resolution: false
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "required_status_checks",
|
|
41
|
+
parameters: {
|
|
42
|
+
strict_required_status_checks_policy: true,
|
|
43
|
+
required_status_checks: [{ context: "ci/build" }]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
description: `Evaluate a ruleset requiring signed commits on release branches without enforcing it. The evaluate enforcement level is not available on all GitHub plans.`,
|
|
54
|
+
example: yaml__default.default.stringify({
|
|
55
|
+
steps: [
|
|
56
|
+
{
|
|
57
|
+
action: "github:repo:rulesets:create",
|
|
58
|
+
name: "Evaluate signed commits",
|
|
59
|
+
input: {
|
|
60
|
+
repoUrl: "github.com?repo=repo&owner=owner",
|
|
61
|
+
name: "release-signed-commits",
|
|
62
|
+
enforcement: "evaluate",
|
|
63
|
+
conditions: {
|
|
64
|
+
ref_name: {
|
|
65
|
+
include: ["refs/heads/release/*"]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
rules: [{ type: "required_signatures" }]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
})
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
description: `Prevent version tags from being updated or deleted.`,
|
|
76
|
+
example: yaml__default.default.stringify({
|
|
77
|
+
steps: [
|
|
78
|
+
{
|
|
79
|
+
action: "github:repo:rulesets:create",
|
|
80
|
+
name: "Protect version tags",
|
|
81
|
+
input: {
|
|
82
|
+
repoUrl: "github.com?repo=repo&owner=owner",
|
|
83
|
+
name: "version-tags",
|
|
84
|
+
target: "tag",
|
|
85
|
+
conditions: {
|
|
86
|
+
ref_name: {
|
|
87
|
+
include: ["refs/tags/v*"]
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
rules: [{ type: "update" }, { type: "deletion" }]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
})
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
description: `Require linear history on all branches, allowing repository admins to bypass the ruleset.`,
|
|
98
|
+
example: yaml__default.default.stringify({
|
|
99
|
+
steps: [
|
|
100
|
+
{
|
|
101
|
+
action: "github:repo:rulesets:create",
|
|
102
|
+
name: "Require linear history",
|
|
103
|
+
input: {
|
|
104
|
+
repoUrl: "github.com?repo=repo&owner=owner",
|
|
105
|
+
name: "linear-history",
|
|
106
|
+
conditions: {
|
|
107
|
+
ref_name: {
|
|
108
|
+
include: ["~ALL"]
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
rules: [{ type: "required_linear_history" }],
|
|
112
|
+
bypassActors: [
|
|
113
|
+
{
|
|
114
|
+
actor_id: 5,
|
|
115
|
+
actor_type: "RepositoryRole",
|
|
116
|
+
bypass_mode: "always"
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
exports.examples = examples;
|
|
127
|
+
//# sourceMappingURL=githubRulesets.examples.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"githubRulesets.examples.cjs.js","sources":["../../src/actions/githubRulesets.examples.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: `Require a pull request with one approval and passing status checks on the repository's default branch.`,\n example: yaml.stringify({\n steps: [\n {\n action: 'github:repo:rulesets:create',\n name: 'Protect default branch',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n name: 'default-branch',\n conditions: {\n ref_name: {\n include: ['~DEFAULT_BRANCH'],\n exclude: [],\n },\n },\n rules: [\n { type: 'deletion' },\n { type: 'non_fast_forward' },\n {\n type: 'pull_request',\n parameters: {\n required_approving_review_count: 1,\n dismiss_stale_reviews_on_push: true,\n require_code_owner_review: false,\n require_last_push_approval: false,\n required_review_thread_resolution: false,\n },\n },\n {\n type: 'required_status_checks',\n parameters: {\n strict_required_status_checks_policy: true,\n required_status_checks: [{ context: 'ci/build' }],\n },\n },\n ],\n },\n },\n ],\n }),\n },\n {\n description: `Evaluate a ruleset requiring signed commits on release branches without enforcing it. The evaluate enforcement level is not available on all GitHub plans.`,\n example: yaml.stringify({\n steps: [\n {\n action: 'github:repo:rulesets:create',\n name: 'Evaluate signed commits',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n name: 'release-signed-commits',\n enforcement: 'evaluate',\n conditions: {\n ref_name: {\n include: ['refs/heads/release/*'],\n },\n },\n rules: [{ type: 'required_signatures' }],\n },\n },\n ],\n }),\n },\n {\n description: `Prevent version tags from being updated or deleted.`,\n example: yaml.stringify({\n steps: [\n {\n action: 'github:repo:rulesets:create',\n name: 'Protect version tags',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n name: 'version-tags',\n target: 'tag',\n conditions: {\n ref_name: {\n include: ['refs/tags/v*'],\n },\n },\n rules: [{ type: 'update' }, { type: 'deletion' }],\n },\n },\n ],\n }),\n },\n {\n description: `Require linear history on all branches, allowing repository admins to bypass the ruleset.`,\n example: yaml.stringify({\n steps: [\n {\n action: 'github:repo:rulesets:create',\n name: 'Require linear history',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n name: 'linear-history',\n conditions: {\n ref_name: {\n include: ['~ALL'],\n },\n },\n rules: [{ type: 'required_linear_history' }],\n bypassActors: [\n {\n actor_id: 5,\n actor_type: 'RepositoryRole',\n bypass_mode: 'always',\n },\n ],\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,CAAA,sGAAA,CAAA;AAAA,IACb,OAA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A,EAAa;AAAA;AACf;AACF;AACF;AACF;AACF,KACD;AAAA;AAEL;;"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -15,6 +15,7 @@ var github = require('./actions/github.cjs.js');
|
|
|
15
15
|
var githubAutolinks = require('./actions/githubAutolinks.cjs.js');
|
|
16
16
|
var githubPagesEnable = require('./actions/githubPagesEnable.cjs.js');
|
|
17
17
|
var githubBranchProtection = require('./actions/githubBranchProtection.cjs.js');
|
|
18
|
+
var githubRulesets = require('./actions/githubRulesets.cjs.js');
|
|
18
19
|
var module$1 = require('./module.cjs.js');
|
|
19
20
|
var util = require('./util.cjs.js');
|
|
20
21
|
|
|
@@ -33,6 +34,7 @@ exports.createPublishGithubAction = github.createPublishGithubAction;
|
|
|
33
34
|
exports.createGithubAutolinksAction = githubAutolinks.createGithubAutolinksAction;
|
|
34
35
|
exports.createGithubPagesEnableAction = githubPagesEnable.createGithubPagesEnableAction;
|
|
35
36
|
exports.createGithubBranchProtectionAction = githubBranchProtection.createGithubBranchProtectionAction;
|
|
37
|
+
exports.createGithubRepoRulesetsCreateAction = githubRulesets.createGithubRepoRulesetsCreateAction;
|
|
36
38
|
exports.default = module$1.githubModule;
|
|
37
39
|
exports.getOctokitClient = util.getOctokitClient;
|
|
38
40
|
exports.getOctokitOptions = util.getOctokitOptions;
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -457,6 +457,40 @@ declare function createGithubBranchProtectionAction(options: {
|
|
|
457
457
|
[x: string]: any;
|
|
458
458
|
}, "v2">;
|
|
459
459
|
|
|
460
|
+
/**
|
|
461
|
+
* Creates a `github:repo:rulesets:create` Scaffolder action that creates a ruleset in a GitHub repository.
|
|
462
|
+
*
|
|
463
|
+
* @public
|
|
464
|
+
*/
|
|
465
|
+
declare function createGithubRepoRulesetsCreateAction(options: {
|
|
466
|
+
integrations: ScmIntegrationRegistry;
|
|
467
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
468
|
+
requireScmUserCredentials?: boolean;
|
|
469
|
+
}): _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
470
|
+
repoUrl: string;
|
|
471
|
+
name: string;
|
|
472
|
+
target: "tag" | "branch";
|
|
473
|
+
enforcement: "active" | "disabled" | "evaluate";
|
|
474
|
+
conditions?: {
|
|
475
|
+
ref_name?: {
|
|
476
|
+
include?: string[] | undefined;
|
|
477
|
+
exclude?: string[] | undefined;
|
|
478
|
+
} | undefined;
|
|
479
|
+
} | undefined;
|
|
480
|
+
rules?: {
|
|
481
|
+
type: string;
|
|
482
|
+
parameters?: Record<string, any> | undefined;
|
|
483
|
+
}[] | undefined;
|
|
484
|
+
bypassActors?: {
|
|
485
|
+
actor_type: string;
|
|
486
|
+
bypass_mode?: "always" | "pull_request" | "exempt" | undefined;
|
|
487
|
+
actor_id?: number | null | undefined;
|
|
488
|
+
}[] | undefined;
|
|
489
|
+
token?: string | undefined;
|
|
490
|
+
}, {
|
|
491
|
+
id: number;
|
|
492
|
+
}, "v2">;
|
|
493
|
+
|
|
460
494
|
/**
|
|
461
495
|
* @public
|
|
462
496
|
* The GitHub Module for the Scaffolder Backend
|
|
@@ -519,5 +553,5 @@ declare function getOctokitOptions(options: {
|
|
|
519
553
|
repoUrl: string;
|
|
520
554
|
}): Promise<OctokitOptions>;
|
|
521
555
|
|
|
522
|
-
export { createGithubActionsDispatchAction, createGithubAutolinksAction, createGithubBranchProtectionAction, createGithubDeployKeyAction, createGithubEnvironmentAction, createGithubIssuesCreateAction, createGithubIssuesLabelAction, createGithubPagesEnableAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishGithubAction, createPublishGithubPullRequestAction, githubModule as default, getOctokitClient, getOctokitOptions };
|
|
556
|
+
export { createGithubActionsDispatchAction, createGithubAutolinksAction, createGithubBranchProtectionAction, createGithubDeployKeyAction, createGithubEnvironmentAction, createGithubIssuesCreateAction, createGithubIssuesLabelAction, createGithubPagesEnableAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubRepoRulesetsCreateAction, createGithubWebhookAction, createPublishGithubAction, createPublishGithubPullRequestAction, githubModule as default, getOctokitClient, getOctokitOptions };
|
|
523
557
|
export type { CreateGithubPullRequestActionOptions, RetryOptions };
|
package/dist/module.cjs.js
CHANGED
|
@@ -15,6 +15,7 @@ var github = require('./actions/github.cjs.js');
|
|
|
15
15
|
var githubAutolinks = require('./actions/githubAutolinks.cjs.js');
|
|
16
16
|
var githubPagesEnable = require('./actions/githubPagesEnable.cjs.js');
|
|
17
17
|
var githubBranchProtection = require('./actions/githubBranchProtection.cjs.js');
|
|
18
|
+
var githubRulesets = require('./actions/githubRulesets.cjs.js');
|
|
18
19
|
var integration = require('@backstage/integration');
|
|
19
20
|
var autocomplete = require('./autocomplete/autocomplete.cjs.js');
|
|
20
21
|
var pluginCatalogNode = require('@backstage/plugin-catalog-node');
|
|
@@ -100,6 +101,11 @@ const githubModule = backendPluginApi.createBackendModule({
|
|
|
100
101
|
githubBranchProtection.createGithubBranchProtectionAction({
|
|
101
102
|
integrations,
|
|
102
103
|
requireScmUserCredentials
|
|
104
|
+
}),
|
|
105
|
+
githubRulesets.createGithubRepoRulesetsCreateAction({
|
|
106
|
+
integrations,
|
|
107
|
+
githubCredentialsProvider,
|
|
108
|
+
requireScmUserCredentials
|
|
103
109
|
})
|
|
104
110
|
);
|
|
105
111
|
autocomplete$1.addAutocompleteProvider({
|
package/dist/module.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { scaffolderAutocompleteExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createGithubActionsDispatchAction,\n createGithubAutolinksAction,\n createGithubDeployKeyAction,\n createGithubEnvironmentAction,\n createGithubIssuesLabelAction,\n createGithubIssuesCreateAction,\n createGithubRepoCreateAction,\n createGithubRepoPushAction,\n createGithubWebhookAction,\n createPublishGithubAction,\n createPublishGithubPullRequestAction,\n createGithubPagesEnableAction,\n createGithubBranchProtectionAction,\n} from './actions';\nimport {\n DefaultGithubCredentialsProvider,\n ScmIntegrations,\n} from '@backstage/integration';\nimport { createHandleAutocompleteRequest } from './autocomplete/autocomplete';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node';\nimport { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node';\n\n/**\n * @public\n * The GitHub Module for the Scaffolder Backend\n */\nexport const githubModule = createBackendModule({\n pluginId: 'scaffolder',\n moduleId: 'github',\n register({ registerInit }) {\n registerInit({\n deps: {\n scaffolder: scaffolderActionsExtensionPoint,\n config: coreServices.rootConfig,\n catalog: catalogServiceRef,\n autocomplete: scaffolderAutocompleteExtensionPoint,\n },\n async init({ scaffolder, config, autocomplete, catalog }) {\n const integrations = ScmIntegrations.fromConfig(config);\n const requireScmUserCredentials =\n config.getOptionalBoolean('scaffolder.requireScmUserCredentials') ??\n false;\n const githubCredentialsProvider =\n DefaultGithubCredentialsProvider.fromIntegrations(integrations);\n\n scaffolder.addActions(\n createGithubActionsDispatchAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createGithubAutolinksAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createGithubDeployKeyAction({\n integrations,\n requireScmUserCredentials,\n }),\n createGithubEnvironmentAction({\n integrations,\n catalog,\n requireScmUserCredentials,\n }),\n createGithubIssuesLabelAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createGithubIssuesCreateAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createGithubRepoCreateAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createGithubRepoPushAction({\n integrations,\n config,\n requireScmUserCredentials,\n }),\n createGithubWebhookAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createPublishGithubAction({\n integrations,\n config,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createPublishGithubPullRequestAction({\n integrations,\n githubCredentialsProvider,\n config,\n requireScmUserCredentials,\n }),\n createGithubPagesEnableAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createGithubBranchProtectionAction({\n integrations,\n requireScmUserCredentials,\n }),\n );\n\n autocomplete.addAutocompleteProvider({\n id: 'github',\n handler: createHandleAutocompleteRequest({ integrations }),\n });\n },\n });\n },\n});\n"],"names":["createBackendModule","scaffolderActionsExtensionPoint","coreServices","catalogServiceRef","scaffolderAutocompleteExtensionPoint","autocomplete","ScmIntegrations","DefaultGithubCredentialsProvider","createGithubActionsDispatchAction","createGithubAutolinksAction","createGithubDeployKeyAction","createGithubEnvironmentAction","createGithubIssuesLabelAction","createGithubIssuesCreateAction","createGithubRepoCreateAction","createGithubRepoPushAction","createGithubWebhookAction","createPublishGithubAction","createPublishGithubPullRequestAction","createGithubPagesEnableAction","createGithubBranchProtectionAction","createHandleAutocompleteRequest"],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { scaffolderAutocompleteExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createGithubActionsDispatchAction,\n createGithubAutolinksAction,\n createGithubDeployKeyAction,\n createGithubEnvironmentAction,\n createGithubIssuesLabelAction,\n createGithubIssuesCreateAction,\n createGithubRepoCreateAction,\n createGithubRepoPushAction,\n createGithubWebhookAction,\n createPublishGithubAction,\n createPublishGithubPullRequestAction,\n createGithubPagesEnableAction,\n createGithubBranchProtectionAction,\n createGithubRepoRulesetsCreateAction,\n} from './actions';\nimport {\n DefaultGithubCredentialsProvider,\n ScmIntegrations,\n} from '@backstage/integration';\nimport { createHandleAutocompleteRequest } from './autocomplete/autocomplete';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node';\nimport { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node';\n\n/**\n * @public\n * The GitHub Module for the Scaffolder Backend\n */\nexport const githubModule = createBackendModule({\n pluginId: 'scaffolder',\n moduleId: 'github',\n register({ registerInit }) {\n registerInit({\n deps: {\n scaffolder: scaffolderActionsExtensionPoint,\n config: coreServices.rootConfig,\n catalog: catalogServiceRef,\n autocomplete: scaffolderAutocompleteExtensionPoint,\n },\n async init({ scaffolder, config, autocomplete, catalog }) {\n const integrations = ScmIntegrations.fromConfig(config);\n const requireScmUserCredentials =\n config.getOptionalBoolean('scaffolder.requireScmUserCredentials') ??\n false;\n const githubCredentialsProvider =\n DefaultGithubCredentialsProvider.fromIntegrations(integrations);\n\n scaffolder.addActions(\n createGithubActionsDispatchAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createGithubAutolinksAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createGithubDeployKeyAction({\n integrations,\n requireScmUserCredentials,\n }),\n createGithubEnvironmentAction({\n integrations,\n catalog,\n requireScmUserCredentials,\n }),\n createGithubIssuesLabelAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createGithubIssuesCreateAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createGithubRepoCreateAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createGithubRepoPushAction({\n integrations,\n config,\n requireScmUserCredentials,\n }),\n createGithubWebhookAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createPublishGithubAction({\n integrations,\n config,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createPublishGithubPullRequestAction({\n integrations,\n githubCredentialsProvider,\n config,\n requireScmUserCredentials,\n }),\n createGithubPagesEnableAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n createGithubBranchProtectionAction({\n integrations,\n requireScmUserCredentials,\n }),\n createGithubRepoRulesetsCreateAction({\n integrations,\n githubCredentialsProvider,\n requireScmUserCredentials,\n }),\n );\n\n autocomplete.addAutocompleteProvider({\n id: 'github',\n handler: createHandleAutocompleteRequest({ integrations }),\n });\n },\n });\n },\n});\n"],"names":["createBackendModule","scaffolderActionsExtensionPoint","coreServices","catalogServiceRef","scaffolderAutocompleteExtensionPoint","autocomplete","ScmIntegrations","DefaultGithubCredentialsProvider","createGithubActionsDispatchAction","createGithubAutolinksAction","createGithubDeployKeyAction","createGithubEnvironmentAction","createGithubIssuesLabelAction","createGithubIssuesCreateAction","createGithubRepoCreateAction","createGithubRepoPushAction","createGithubWebhookAction","createPublishGithubAction","createPublishGithubPullRequestAction","createGithubPagesEnableAction","createGithubBranchProtectionAction","createGithubRepoRulesetsCreateA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AA,WACD,CAAA;AAAA,UACDC,6CAAA,CAA6B;AAAA,YAC3B,YAAA;AAAA,YACA,yBAAA;AAAA,YACA;AAAA,WACD,CAAA;AAAA,UACDC,yCAAA,CAA2B;AAAA,YACzB,YAAA;AAAA,YACA,MAAA;AAAA,YACA;AAAA,WACD,CAAA;AAAA,UACDC,uCAAA,CAA0B;AAAA,YACxB,YAAA;AAAA,YACA,yBAAA;AAAA,YACA;AAAA,WACD,CAAA;AAAA,UACDC,gCAAA,CAA0B;AAAA,YACxB,YAAA;AAAA,YACA,MAAA;AAAA,YACA,yBAAA;AAAA,YACA;AAAA,WACD,CAAA;AAAA,UACDC,sDAAA,CAAqC;AAAA,YACnC,YAAA;AAAA,YACA,yBAAA;AAAA,YACA,MAAA;AAAA,YACA;AAAA,WACD,CAAA;AAAA,UACDC,+CAAA,CAA8B;AAAA,YAC5B,YAAA;AAAA,YACA,yBAAA;AAAA,YACA;AAAA,WACD,CAAA;AAAA,UACDC,yDAAA,CAAmC;AAAA,YACjC,YAAA;AAAA,YACA;AAAA,WACD,CAAA;AAAA,UACDC,mDAAA,CAAqC;AAAA,YACnC,YAAA;AAAA,YACA,yBAAA;AAAA,YACA;AAAA,WACD;AAAA,SACH;AAEA,QAAAhB,cAAA,CAAa,uBAAA,CAAwB;AAAA,UACnC,EAAA,EAAI,QAAA;AAAA,UACJ,OAAA,EAASiB,4CAAA,CAAgC,EAAE,YAAA,EAAc;AAAA,SAC1D,CAAA;AAAA,MACH;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-backend-module-github",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.4",
|
|
4
4
|
"description": "The github module for @backstage/plugin-scaffolder-backend",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"test": "backstage-cli package test"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@backstage/backend-plugin-api": "^1.
|
|
54
|
-
"@backstage/catalog-model": "^1.10.
|
|
55
|
-
"@backstage/config": "^1.3.
|
|
56
|
-
"@backstage/errors": "^1.
|
|
57
|
-
"@backstage/integration": "^2.
|
|
58
|
-
"@backstage/plugin-catalog-node": "^
|
|
59
|
-
"@backstage/plugin-scaffolder-node": "^0.
|
|
53
|
+
"@backstage/backend-plugin-api": "^1.12.0",
|
|
54
|
+
"@backstage/catalog-model": "^1.10.3",
|
|
55
|
+
"@backstage/config": "^1.3.11",
|
|
56
|
+
"@backstage/errors": "^1.4.0",
|
|
57
|
+
"@backstage/integration": "^2.2.0",
|
|
58
|
+
"@backstage/plugin-catalog-node": "^3.0.0",
|
|
59
|
+
"@backstage/plugin-scaffolder-node": "^1.0.0",
|
|
60
60
|
"@backstage/types": "^1.2.2",
|
|
61
61
|
"@octokit/core": "^5.0.0",
|
|
62
62
|
"@octokit/plugin-retry": "^6.0.0",
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"zod": "^3.25.76 || ^4.0.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@backstage/backend-test-utils": "^1.
|
|
72
|
-
"@backstage/cli": "^0.36.
|
|
73
|
-
"@backstage/plugin-scaffolder-node-test-utils": "^0.3.
|
|
71
|
+
"@backstage/backend-test-utils": "^1.12.0",
|
|
72
|
+
"@backstage/cli": "^0.36.8",
|
|
73
|
+
"@backstage/plugin-scaffolder-node-test-utils": "^0.3.17",
|
|
74
74
|
"@types/libsodium-wrappers": "^0.8.0",
|
|
75
75
|
"fs-extra": "^11.2.0",
|
|
76
76
|
"jsonschema": "^1.2.6"
|