@backstage/plugin-scaffolder-backend 1.18.0-next.1 → 1.18.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 +74 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +1 -1
- package/dist/cjs/{router-2e0adf31.cjs.js → router-d7df4c2b.cjs.js} +373 -30
- package/dist/cjs/router-d7df4c2b.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +26 -0
- package/package.json +20 -22
- package/dist/cjs/router-2e0adf31.cjs.js.map +0 -1
|
@@ -80,7 +80,7 @@ var winston__namespace = /*#__PURE__*/_interopNamespace(winston);
|
|
|
80
80
|
var nunjucks__default = /*#__PURE__*/_interopDefaultLegacy(nunjucks);
|
|
81
81
|
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
|
|
82
82
|
|
|
83
|
-
const examples$
|
|
83
|
+
const examples$h = [
|
|
84
84
|
{
|
|
85
85
|
description: "Register with the catalog",
|
|
86
86
|
example: yaml__default["default"].stringify({
|
|
@@ -104,7 +104,7 @@ function createCatalogRegisterAction(options) {
|
|
|
104
104
|
return pluginScaffolderNode.createTemplateAction({
|
|
105
105
|
id: id$4,
|
|
106
106
|
description: "Registers entities from a catalog descriptor file in the workspace into the software catalog.",
|
|
107
|
-
examples: examples$
|
|
107
|
+
examples: examples$h,
|
|
108
108
|
schema: {
|
|
109
109
|
input: {
|
|
110
110
|
oneOf: [
|
|
@@ -228,7 +228,7 @@ function createCatalogRegisterAction(options) {
|
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
const examples$
|
|
231
|
+
const examples$g = [
|
|
232
232
|
{
|
|
233
233
|
description: "Write a catalog yaml file",
|
|
234
234
|
example: yaml__namespace.stringify({
|
|
@@ -272,7 +272,7 @@ function createCatalogWriteAction() {
|
|
|
272
272
|
)
|
|
273
273
|
})
|
|
274
274
|
},
|
|
275
|
-
examples: examples$
|
|
275
|
+
examples: examples$g,
|
|
276
276
|
supportsDryRun: true,
|
|
277
277
|
async handler(ctx) {
|
|
278
278
|
ctx.logStream.write(`Writing catalog-info.yaml`);
|
|
@@ -286,7 +286,7 @@ function createCatalogWriteAction() {
|
|
|
286
286
|
});
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
const examples$
|
|
289
|
+
const examples$f = [
|
|
290
290
|
{
|
|
291
291
|
description: "Fetch entity by reference",
|
|
292
292
|
example: yaml__default["default"].stringify({
|
|
@@ -325,7 +325,7 @@ function createFetchCatalogEntityAction(options) {
|
|
|
325
325
|
return pluginScaffolderNode.createTemplateAction({
|
|
326
326
|
id: id$2,
|
|
327
327
|
description: "Returns entity or entities from the catalog by entity reference(s)",
|
|
328
|
-
examples: examples$
|
|
328
|
+
examples: examples$f,
|
|
329
329
|
supportsDryRun: true,
|
|
330
330
|
schema: {
|
|
331
331
|
input: zod.z.object({
|
|
@@ -400,7 +400,7 @@ function createFetchCatalogEntityAction(options) {
|
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
const examples$
|
|
403
|
+
const examples$e = [
|
|
404
404
|
{
|
|
405
405
|
description: "Write a debug message",
|
|
406
406
|
example: yaml__default["default"].stringify({
|
|
@@ -438,7 +438,7 @@ function createDebugLogAction() {
|
|
|
438
438
|
return pluginScaffolderNode.createTemplateAction({
|
|
439
439
|
id: id$1,
|
|
440
440
|
description: "Writes a message into the log or lists all files in the workspace.",
|
|
441
|
-
examples: examples$
|
|
441
|
+
examples: examples$e,
|
|
442
442
|
schema: {
|
|
443
443
|
input: {
|
|
444
444
|
type: "object",
|
|
@@ -485,7 +485,7 @@ async function recursiveReadDir(dir) {
|
|
|
485
485
|
return files.reduce((a, f) => a.concat(f), []);
|
|
486
486
|
}
|
|
487
487
|
|
|
488
|
-
const examples$
|
|
488
|
+
const examples$d = [
|
|
489
489
|
{
|
|
490
490
|
description: "Waiting for 50 milliseconds",
|
|
491
491
|
example: yaml__default["default"].stringify({
|
|
@@ -548,7 +548,7 @@ function createWaitAction(options) {
|
|
|
548
548
|
return pluginScaffolderNode.createTemplateAction({
|
|
549
549
|
id,
|
|
550
550
|
description: "Waits for a certain period of time.",
|
|
551
|
-
examples: examples$
|
|
551
|
+
examples: examples$d,
|
|
552
552
|
schema: {
|
|
553
553
|
input: {
|
|
554
554
|
type: "object",
|
|
@@ -593,7 +593,7 @@ function createWaitAction(options) {
|
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
595
|
|
|
596
|
-
const examples$
|
|
596
|
+
const examples$c = [
|
|
597
597
|
{
|
|
598
598
|
description: "Downloads content and places it in the workspace.",
|
|
599
599
|
example: yaml__default["default"].stringify({
|
|
@@ -632,7 +632,7 @@ function createFetchPlainAction(options) {
|
|
|
632
632
|
const { reader, integrations } = options;
|
|
633
633
|
return pluginScaffolderNode.createTemplateAction({
|
|
634
634
|
id: ACTION_ID,
|
|
635
|
-
examples: examples$
|
|
635
|
+
examples: examples$c,
|
|
636
636
|
description: "Downloads content and places it in the workspace, or optionally in a subdirectory specified by the `targetPath` input option.",
|
|
637
637
|
schema: {
|
|
638
638
|
input: {
|
|
@@ -669,7 +669,7 @@ function createFetchPlainAction(options) {
|
|
|
669
669
|
});
|
|
670
670
|
}
|
|
671
671
|
|
|
672
|
-
const examples$
|
|
672
|
+
const examples$b = [
|
|
673
673
|
{
|
|
674
674
|
description: "Downloads a file and places it in the workspace.",
|
|
675
675
|
example: yaml__default["default"].stringify({
|
|
@@ -693,7 +693,7 @@ function createFetchPlainFileAction(options) {
|
|
|
693
693
|
return pluginScaffolderNode.createTemplateAction({
|
|
694
694
|
id: "fetch:plain:file",
|
|
695
695
|
description: "Downloads single file and places it in the workspace.",
|
|
696
|
-
examples: examples$
|
|
696
|
+
examples: examples$b,
|
|
697
697
|
schema: {
|
|
698
698
|
input: {
|
|
699
699
|
type: "object",
|
|
@@ -961,7 +961,7 @@ const createDefaultFilters = ({
|
|
|
961
961
|
};
|
|
962
962
|
};
|
|
963
963
|
|
|
964
|
-
const examples$
|
|
964
|
+
const examples$a = [
|
|
965
965
|
{
|
|
966
966
|
description: "Downloads a skelaton directory that lives alongside the template file and fill it out with values.",
|
|
967
967
|
example: yaml__default["default"].stringify({
|
|
@@ -997,7 +997,7 @@ function createFetchTemplateAction(options) {
|
|
|
997
997
|
return pluginScaffolderNode.createTemplateAction({
|
|
998
998
|
id: "fetch:template",
|
|
999
999
|
description: "Downloads a skeleton, templates variables into file and directory names and content, and places the result in the workspace, or optionally in a subdirectory specified by the `targetPath` input option.",
|
|
1000
|
-
examples: examples$
|
|
1000
|
+
examples: examples$a,
|
|
1001
1001
|
schema: {
|
|
1002
1002
|
input: {
|
|
1003
1003
|
type: "object",
|
|
@@ -1202,7 +1202,7 @@ function containsSkippedContent(localOutputPath) {
|
|
|
1202
1202
|
return localOutputPath === "" || localOutputPath.startsWith("/") || localOutputPath.includes("//");
|
|
1203
1203
|
}
|
|
1204
1204
|
|
|
1205
|
-
const examples$
|
|
1205
|
+
const examples$9 = [
|
|
1206
1206
|
{
|
|
1207
1207
|
description: "Delete specified files",
|
|
1208
1208
|
example: yaml__namespace.stringify({
|
|
@@ -1224,7 +1224,7 @@ const createFilesystemDeleteAction = () => {
|
|
|
1224
1224
|
return pluginScaffolderNode.createTemplateAction({
|
|
1225
1225
|
id: "fs:delete",
|
|
1226
1226
|
description: "Deletes files and directories from the workspace",
|
|
1227
|
-
examples: examples$
|
|
1227
|
+
examples: examples$9,
|
|
1228
1228
|
schema: {
|
|
1229
1229
|
input: {
|
|
1230
1230
|
required: ["files"],
|
|
@@ -1261,7 +1261,7 @@ const createFilesystemDeleteAction = () => {
|
|
|
1261
1261
|
});
|
|
1262
1262
|
};
|
|
1263
1263
|
|
|
1264
|
-
const examples$
|
|
1264
|
+
const examples$8 = [
|
|
1265
1265
|
{
|
|
1266
1266
|
description: "Rename specified files ",
|
|
1267
1267
|
example: yaml__namespace.stringify({
|
|
@@ -1287,7 +1287,7 @@ const createFilesystemRenameAction = () => {
|
|
|
1287
1287
|
return pluginScaffolderNode.createTemplateAction({
|
|
1288
1288
|
id: "fs:rename",
|
|
1289
1289
|
description: "Renames files and directories within the workspace",
|
|
1290
|
-
examples: examples$
|
|
1290
|
+
examples: examples$8,
|
|
1291
1291
|
schema: {
|
|
1292
1292
|
input: {
|
|
1293
1293
|
required: ["files"],
|
|
@@ -1769,7 +1769,7 @@ async function validateAccessTeam(client, access) {
|
|
|
1769
1769
|
}
|
|
1770
1770
|
}
|
|
1771
1771
|
|
|
1772
|
-
const examples$
|
|
1772
|
+
const examples$7 = [
|
|
1773
1773
|
{
|
|
1774
1774
|
description: "GitHub Action Workflow Without Inputs.",
|
|
1775
1775
|
example: yaml__default["default"].stringify({
|
|
@@ -1830,7 +1830,7 @@ function createGithubActionsDispatchAction(options) {
|
|
|
1830
1830
|
return pluginScaffolderNode.createTemplateAction({
|
|
1831
1831
|
id: "github:actions:dispatch",
|
|
1832
1832
|
description: "Dispatches a GitHub Action workflow for a given branch or tag",
|
|
1833
|
-
examples: examples$
|
|
1833
|
+
examples: examples$7,
|
|
1834
1834
|
schema: {
|
|
1835
1835
|
input: {
|
|
1836
1836
|
type: "object",
|
|
@@ -1899,11 +1899,48 @@ function createGithubActionsDispatchAction(options) {
|
|
|
1899
1899
|
});
|
|
1900
1900
|
}
|
|
1901
1901
|
|
|
1902
|
+
const examples$6 = [
|
|
1903
|
+
{
|
|
1904
|
+
description: "Add labels to pull request or issue",
|
|
1905
|
+
example: yaml__default["default"].stringify({
|
|
1906
|
+
steps: [
|
|
1907
|
+
{
|
|
1908
|
+
action: "github:issues:label",
|
|
1909
|
+
name: "Add labels to pull request or issue",
|
|
1910
|
+
input: {
|
|
1911
|
+
repoUrl: "github.com?repo=repo&owner=owner",
|
|
1912
|
+
number: "1",
|
|
1913
|
+
labels: ["bug"]
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
]
|
|
1917
|
+
})
|
|
1918
|
+
},
|
|
1919
|
+
{
|
|
1920
|
+
description: "Add labels to pull request or issue with specific token",
|
|
1921
|
+
example: yaml__default["default"].stringify({
|
|
1922
|
+
steps: [
|
|
1923
|
+
{
|
|
1924
|
+
action: "github:issues:label",
|
|
1925
|
+
name: "Add labels to pull request or issue with token",
|
|
1926
|
+
input: {
|
|
1927
|
+
repoUrl: "github.com?repo=repo&owner=owner",
|
|
1928
|
+
number: "1",
|
|
1929
|
+
labels: ["bug", "documentation"],
|
|
1930
|
+
token: "gph_YourGitHubToken"
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
]
|
|
1934
|
+
})
|
|
1935
|
+
}
|
|
1936
|
+
];
|
|
1937
|
+
|
|
1902
1938
|
function createGithubIssuesLabelAction(options) {
|
|
1903
1939
|
const { integrations, githubCredentialsProvider } = options;
|
|
1904
1940
|
return pluginScaffolderNode.createTemplateAction({
|
|
1905
1941
|
id: "github:issues:label",
|
|
1906
1942
|
description: "Adds labels to a pull request or issue on GitHub.",
|
|
1943
|
+
examples: examples$6,
|
|
1907
1944
|
schema: {
|
|
1908
1945
|
input: {
|
|
1909
1946
|
type: "object",
|
|
@@ -2226,7 +2263,7 @@ const commitHash = {
|
|
|
2226
2263
|
type: "string"
|
|
2227
2264
|
};
|
|
2228
2265
|
|
|
2229
|
-
const examples$
|
|
2266
|
+
const examples$5 = [
|
|
2230
2267
|
{
|
|
2231
2268
|
description: "Creates a GitHub repository with default configuration.",
|
|
2232
2269
|
example: yaml__default["default"].stringify({
|
|
@@ -2279,7 +2316,7 @@ function createGithubRepoCreateAction(options) {
|
|
|
2279
2316
|
return pluginScaffolderNode.createTemplateAction({
|
|
2280
2317
|
id: "github:repo:create",
|
|
2281
2318
|
description: "Creates a GitHub repository.",
|
|
2282
|
-
examples: examples$
|
|
2319
|
+
examples: examples$5,
|
|
2283
2320
|
schema: {
|
|
2284
2321
|
input: {
|
|
2285
2322
|
type: "object",
|
|
@@ -2386,7 +2423,7 @@ function createGithubRepoCreateAction(options) {
|
|
|
2386
2423
|
});
|
|
2387
2424
|
}
|
|
2388
2425
|
|
|
2389
|
-
const examples$
|
|
2426
|
+
const examples$4 = [
|
|
2390
2427
|
{
|
|
2391
2428
|
description: "Setup repo with no modifications to branch protection rules",
|
|
2392
2429
|
example: yaml__default["default"].stringify({
|
|
@@ -2438,7 +2475,7 @@ function createGithubRepoPushAction(options) {
|
|
|
2438
2475
|
return pluginScaffolderNode.createTemplateAction({
|
|
2439
2476
|
id: "github:repo:push",
|
|
2440
2477
|
description: "Initializes a git repository of contents in workspace and publishes it to GitHub.",
|
|
2441
|
-
examples: examples$
|
|
2478
|
+
examples: examples$4,
|
|
2442
2479
|
schema: {
|
|
2443
2480
|
input: {
|
|
2444
2481
|
type: "object",
|
|
@@ -2912,10 +2949,62 @@ function createGithubEnvironmentAction(options) {
|
|
|
2912
2949
|
});
|
|
2913
2950
|
}
|
|
2914
2951
|
|
|
2952
|
+
const examples$3 = [
|
|
2953
|
+
{
|
|
2954
|
+
description: "Initializes a git repository of the content in the workspace, and publishes it to Azure.",
|
|
2955
|
+
example: yaml__default["default"].stringify({
|
|
2956
|
+
steps: [
|
|
2957
|
+
{
|
|
2958
|
+
id: "publish",
|
|
2959
|
+
action: "publish:azure",
|
|
2960
|
+
name: "Publish to Azure",
|
|
2961
|
+
input: {
|
|
2962
|
+
repoUrl: "dev.azure.com?organization=organization&owner=project&repo=repo"
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
]
|
|
2966
|
+
})
|
|
2967
|
+
},
|
|
2968
|
+
{
|
|
2969
|
+
description: "Add a description.",
|
|
2970
|
+
example: yaml__default["default"].stringify({
|
|
2971
|
+
steps: [
|
|
2972
|
+
{
|
|
2973
|
+
id: "publish",
|
|
2974
|
+
action: "publish:azure",
|
|
2975
|
+
name: "Publish to Azure",
|
|
2976
|
+
input: {
|
|
2977
|
+
repoUrl: "dev.azure.com?organization=organization&owner=project&repo=repo",
|
|
2978
|
+
description: "Initialize a git repository"
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
]
|
|
2982
|
+
})
|
|
2983
|
+
},
|
|
2984
|
+
{
|
|
2985
|
+
description: "Change the default branch.",
|
|
2986
|
+
example: yaml__default["default"].stringify({
|
|
2987
|
+
steps: [
|
|
2988
|
+
{
|
|
2989
|
+
id: "publish",
|
|
2990
|
+
action: "publish:azure",
|
|
2991
|
+
name: "Publish to Azure",
|
|
2992
|
+
input: {
|
|
2993
|
+
repoUrl: "dev.azure.com?organization=organization&owner=project&repo=repo",
|
|
2994
|
+
description: "Initialize a git repository",
|
|
2995
|
+
defaultBranch: "main"
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
]
|
|
2999
|
+
})
|
|
3000
|
+
}
|
|
3001
|
+
];
|
|
3002
|
+
|
|
2915
3003
|
function createPublishAzureAction(options) {
|
|
2916
3004
|
const { integrations, config } = options;
|
|
2917
3005
|
return pluginScaffolderNode.createTemplateAction({
|
|
2918
3006
|
id: "publish:azure",
|
|
3007
|
+
examples: examples$3,
|
|
2919
3008
|
description: "Initializes a git repository of the content in the workspace, and publishes it to Azure.",
|
|
2920
3009
|
schema: {
|
|
2921
3010
|
input: {
|
|
@@ -4973,6 +5062,81 @@ const examples = [
|
|
|
4973
5062
|
}
|
|
4974
5063
|
]
|
|
4975
5064
|
})
|
|
5065
|
+
},
|
|
5066
|
+
{
|
|
5067
|
+
description: "Initializes a git repository with additional settings.",
|
|
5068
|
+
example: yaml__default["default"].stringify({
|
|
5069
|
+
steps: [
|
|
5070
|
+
{
|
|
5071
|
+
id: "publish",
|
|
5072
|
+
action: "publish:gitlab",
|
|
5073
|
+
name: "Publish to GitLab",
|
|
5074
|
+
input: {
|
|
5075
|
+
repoUrl: "gitlab.com?repo=project_name&owner=group_name",
|
|
5076
|
+
settings: {
|
|
5077
|
+
ci_config_path: ".gitlab-ci.yml",
|
|
5078
|
+
visibility: "public"
|
|
5079
|
+
}
|
|
5080
|
+
}
|
|
5081
|
+
}
|
|
5082
|
+
]
|
|
5083
|
+
})
|
|
5084
|
+
},
|
|
5085
|
+
{
|
|
5086
|
+
description: "Initializes a git repository with branches settings",
|
|
5087
|
+
example: yaml__default["default"].stringify({
|
|
5088
|
+
steps: [
|
|
5089
|
+
{
|
|
5090
|
+
id: "publish",
|
|
5091
|
+
action: "publish:gitlab",
|
|
5092
|
+
name: "Publish to GitLab",
|
|
5093
|
+
input: {
|
|
5094
|
+
repoUrl: "gitlab.com?repo=project_name&owner=group_name",
|
|
5095
|
+
branches: [
|
|
5096
|
+
{
|
|
5097
|
+
name: "dev",
|
|
5098
|
+
create: true,
|
|
5099
|
+
protected: true,
|
|
5100
|
+
ref: "master"
|
|
5101
|
+
},
|
|
5102
|
+
{
|
|
5103
|
+
name: "master",
|
|
5104
|
+
protected: true
|
|
5105
|
+
}
|
|
5106
|
+
]
|
|
5107
|
+
}
|
|
5108
|
+
}
|
|
5109
|
+
]
|
|
5110
|
+
})
|
|
5111
|
+
},
|
|
5112
|
+
{
|
|
5113
|
+
description: "Initializes a git repository with environment variables",
|
|
5114
|
+
example: yaml__default["default"].stringify({
|
|
5115
|
+
steps: [
|
|
5116
|
+
{
|
|
5117
|
+
id: "publish",
|
|
5118
|
+
action: "publish:gitlab",
|
|
5119
|
+
name: "Publish to GitLab",
|
|
5120
|
+
input: {
|
|
5121
|
+
repoUrl: "gitlab.com?repo=project_name&owner=group_name",
|
|
5122
|
+
projectVariables: [
|
|
5123
|
+
{
|
|
5124
|
+
key: "key1",
|
|
5125
|
+
value: "value1",
|
|
5126
|
+
protected: true,
|
|
5127
|
+
masked: false
|
|
5128
|
+
},
|
|
5129
|
+
{
|
|
5130
|
+
key: "key2",
|
|
5131
|
+
value: "value2",
|
|
5132
|
+
protected: true,
|
|
5133
|
+
masked: false
|
|
5134
|
+
}
|
|
5135
|
+
]
|
|
5136
|
+
}
|
|
5137
|
+
}
|
|
5138
|
+
]
|
|
5139
|
+
})
|
|
4976
5140
|
}
|
|
4977
5141
|
];
|
|
4978
5142
|
|
|
@@ -4994,6 +5158,7 @@ function createPublishGitlabAction(options) {
|
|
|
4994
5158
|
},
|
|
4995
5159
|
repoVisibility: {
|
|
4996
5160
|
title: "Repository Visibility",
|
|
5161
|
+
description: `Sets the visibility of the repository. The default value is 'private'. (deprecated, use settings.visibility instead)`,
|
|
4997
5162
|
type: "string",
|
|
4998
5163
|
enum: ["private", "public", "internal"]
|
|
4999
5164
|
},
|
|
@@ -5034,11 +5199,128 @@ function createPublishGitlabAction(options) {
|
|
|
5034
5199
|
},
|
|
5035
5200
|
topics: {
|
|
5036
5201
|
title: "Topic labels",
|
|
5037
|
-
description: "Topic labels to apply on the repository.",
|
|
5202
|
+
description: "Topic labels to apply on the repository. (deprecated, use settings.topics instead)",
|
|
5038
5203
|
type: "array",
|
|
5039
5204
|
items: {
|
|
5040
5205
|
type: "string"
|
|
5041
5206
|
}
|
|
5207
|
+
},
|
|
5208
|
+
settings: {
|
|
5209
|
+
title: "Project settings",
|
|
5210
|
+
description: "Additional project settings, based on https://docs.gitlab.com/ee/api/projects.html#create-project attributes",
|
|
5211
|
+
type: "object",
|
|
5212
|
+
properties: {
|
|
5213
|
+
path: {
|
|
5214
|
+
title: "Project path",
|
|
5215
|
+
description: "Repository name for new project. Generated based on name if not provided (generated as lowercase with dashes).",
|
|
5216
|
+
type: "string"
|
|
5217
|
+
},
|
|
5218
|
+
auto_devops_enabled: {
|
|
5219
|
+
title: "Auto DevOps enabled",
|
|
5220
|
+
description: "Enable Auto DevOps for this project",
|
|
5221
|
+
type: "boolean"
|
|
5222
|
+
},
|
|
5223
|
+
ci_config_path: {
|
|
5224
|
+
title: "CI config path",
|
|
5225
|
+
description: "Custom CI config path for this project",
|
|
5226
|
+
type: "string"
|
|
5227
|
+
},
|
|
5228
|
+
description: {
|
|
5229
|
+
title: "Project description",
|
|
5230
|
+
description: "Short project description",
|
|
5231
|
+
type: "string"
|
|
5232
|
+
},
|
|
5233
|
+
topics: {
|
|
5234
|
+
title: "Topic labels",
|
|
5235
|
+
description: "Topic labels to apply on the repository",
|
|
5236
|
+
type: "array",
|
|
5237
|
+
items: {
|
|
5238
|
+
type: "string"
|
|
5239
|
+
}
|
|
5240
|
+
},
|
|
5241
|
+
visibility: {
|
|
5242
|
+
title: "Project visibility",
|
|
5243
|
+
description: "The visibility of the project. Can be private, internal, or public. The default value is private.",
|
|
5244
|
+
type: "string",
|
|
5245
|
+
enum: ["private", "public", "internal"]
|
|
5246
|
+
}
|
|
5247
|
+
}
|
|
5248
|
+
},
|
|
5249
|
+
branches: {
|
|
5250
|
+
title: "Project branches settings",
|
|
5251
|
+
type: "array",
|
|
5252
|
+
items: {
|
|
5253
|
+
type: "object",
|
|
5254
|
+
required: ["name"],
|
|
5255
|
+
properties: {
|
|
5256
|
+
name: {
|
|
5257
|
+
title: "Branch name",
|
|
5258
|
+
type: "string"
|
|
5259
|
+
},
|
|
5260
|
+
protect: {
|
|
5261
|
+
title: "Should branch be protected",
|
|
5262
|
+
description: `Will mark branch as protected. The default value is 'false'`,
|
|
5263
|
+
type: "boolean"
|
|
5264
|
+
},
|
|
5265
|
+
create: {
|
|
5266
|
+
title: "Should branch be created",
|
|
5267
|
+
description: `If branch does not exist, it will be created from provided ref. The default value is 'false'`,
|
|
5268
|
+
type: "boolean"
|
|
5269
|
+
},
|
|
5270
|
+
ref: {
|
|
5271
|
+
title: "Branch reference",
|
|
5272
|
+
description: `Branch reference to create branch from. The default value is 'master'`,
|
|
5273
|
+
type: "string"
|
|
5274
|
+
}
|
|
5275
|
+
}
|
|
5276
|
+
}
|
|
5277
|
+
},
|
|
5278
|
+
projectVariables: {
|
|
5279
|
+
title: "Project variables",
|
|
5280
|
+
description: "Project variables settings based on Gitlab Project Environments API - https://docs.gitlab.com/ee/api/project_level_variables.html#create-a-variable",
|
|
5281
|
+
type: "array",
|
|
5282
|
+
items: {
|
|
5283
|
+
type: "object",
|
|
5284
|
+
required: ["key", "value"],
|
|
5285
|
+
properties: {
|
|
5286
|
+
key: {
|
|
5287
|
+
title: "Variable key",
|
|
5288
|
+
description: "The key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed",
|
|
5289
|
+
type: "string"
|
|
5290
|
+
},
|
|
5291
|
+
value: {
|
|
5292
|
+
title: "Variable value",
|
|
5293
|
+
description: "The value of a variable",
|
|
5294
|
+
type: "string"
|
|
5295
|
+
},
|
|
5296
|
+
description: {
|
|
5297
|
+
title: "Variable description",
|
|
5298
|
+
description: `The description of the variable. The default value is 'null'`,
|
|
5299
|
+
type: "string"
|
|
5300
|
+
},
|
|
5301
|
+
variable_type: {
|
|
5302
|
+
title: "Variable type",
|
|
5303
|
+
description: `The type of a variable. The default value is 'env_var'`,
|
|
5304
|
+
type: "string",
|
|
5305
|
+
enum: ["env_var", "file"]
|
|
5306
|
+
},
|
|
5307
|
+
protected: {
|
|
5308
|
+
title: "Variable protection",
|
|
5309
|
+
description: `Whether the variable is protected. The default value is 'false'`,
|
|
5310
|
+
type: "boolean"
|
|
5311
|
+
},
|
|
5312
|
+
raw: {
|
|
5313
|
+
title: "Variable raw",
|
|
5314
|
+
description: `Whether the variable is in raw format. The default value is 'false'`,
|
|
5315
|
+
type: "boolean"
|
|
5316
|
+
},
|
|
5317
|
+
environment_scope: {
|
|
5318
|
+
title: "Variable environment scope",
|
|
5319
|
+
description: `The environment_scope of the variable. The default value is '*'`,
|
|
5320
|
+
type: "string"
|
|
5321
|
+
}
|
|
5322
|
+
}
|
|
5323
|
+
}
|
|
5042
5324
|
}
|
|
5043
5325
|
}
|
|
5044
5326
|
},
|
|
@@ -5065,6 +5347,7 @@ function createPublishGitlabAction(options) {
|
|
|
5065
5347
|
}
|
|
5066
5348
|
},
|
|
5067
5349
|
async handler(ctx) {
|
|
5350
|
+
var _a, _b, _c, _d, _e;
|
|
5068
5351
|
const {
|
|
5069
5352
|
repoUrl,
|
|
5070
5353
|
repoVisibility = "private",
|
|
@@ -5073,7 +5356,10 @@ function createPublishGitlabAction(options) {
|
|
|
5073
5356
|
gitAuthorName,
|
|
5074
5357
|
gitAuthorEmail,
|
|
5075
5358
|
setUserAsOwner = false,
|
|
5076
|
-
topics = []
|
|
5359
|
+
topics = [],
|
|
5360
|
+
settings = {},
|
|
5361
|
+
branches = [],
|
|
5362
|
+
projectVariables = []
|
|
5077
5363
|
} = ctx.input;
|
|
5078
5364
|
const { owner, repo, host } = parseRepoUrl(repoUrl, integrations);
|
|
5079
5365
|
if (!owner) {
|
|
@@ -5116,7 +5402,8 @@ function createPublishGitlabAction(options) {
|
|
|
5116
5402
|
namespace_id: targetNamespaceId,
|
|
5117
5403
|
name: repo,
|
|
5118
5404
|
visibility: repoVisibility,
|
|
5119
|
-
...topics.length ? { topics } : {}
|
|
5405
|
+
...topics.length ? { topics } : {},
|
|
5406
|
+
...Object.keys(settings).length ? { ...settings } : {}
|
|
5120
5407
|
});
|
|
5121
5408
|
if (setUserAsOwner && integrationConfig.config.token) {
|
|
5122
5409
|
const adminClient = new node.Gitlab({
|
|
@@ -5143,6 +5430,59 @@ function createPublishGitlabAction(options) {
|
|
|
5143
5430
|
commitMessage: gitCommitMessage ? gitCommitMessage : config.getOptionalString("scaffolder.defaultCommitMessage"),
|
|
5144
5431
|
gitAuthorInfo
|
|
5145
5432
|
});
|
|
5433
|
+
if (branches) {
|
|
5434
|
+
for (const branch of branches) {
|
|
5435
|
+
const {
|
|
5436
|
+
name,
|
|
5437
|
+
protect = false,
|
|
5438
|
+
create = false,
|
|
5439
|
+
ref = "master"
|
|
5440
|
+
} = branch;
|
|
5441
|
+
if (create) {
|
|
5442
|
+
try {
|
|
5443
|
+
await client.Branches.create(projectId, name, ref);
|
|
5444
|
+
} catch (e) {
|
|
5445
|
+
throw new errors.InputError(
|
|
5446
|
+
`Branch creation failed for ${name}. ${printGitlabError(e)}`
|
|
5447
|
+
);
|
|
5448
|
+
}
|
|
5449
|
+
ctx.logger.info(
|
|
5450
|
+
`Branch ${name} created for ${projectId} with ref ${ref}`
|
|
5451
|
+
);
|
|
5452
|
+
}
|
|
5453
|
+
if (protect) {
|
|
5454
|
+
try {
|
|
5455
|
+
await client.ProtectedBranches.protect(projectId, name);
|
|
5456
|
+
} catch (e) {
|
|
5457
|
+
throw new errors.InputError(
|
|
5458
|
+
`Branch protection failed for ${name}. ${printGitlabError(e)}`
|
|
5459
|
+
);
|
|
5460
|
+
}
|
|
5461
|
+
ctx.logger.info(`Branch ${name} protected for ${projectId}`);
|
|
5462
|
+
}
|
|
5463
|
+
}
|
|
5464
|
+
}
|
|
5465
|
+
if (projectVariables) {
|
|
5466
|
+
for (const variable of projectVariables) {
|
|
5467
|
+
const variableWithDefaults = Object.assign(variable, {
|
|
5468
|
+
variable_type: (_a = variable.variable_type) != null ? _a : "env_var",
|
|
5469
|
+
protected: (_b = variable.protected) != null ? _b : false,
|
|
5470
|
+
masked: (_c = variable.masked) != null ? _c : false,
|
|
5471
|
+
raw: (_d = variable.raw) != null ? _d : false,
|
|
5472
|
+
environment_scope: (_e = variable.environment_scope) != null ? _e : "*"
|
|
5473
|
+
});
|
|
5474
|
+
try {
|
|
5475
|
+
await client.ProjectVariables.create(
|
|
5476
|
+
projectId,
|
|
5477
|
+
variableWithDefaults
|
|
5478
|
+
);
|
|
5479
|
+
} catch (e) {
|
|
5480
|
+
throw new errors.InputError(
|
|
5481
|
+
`Environment variable creation failed for ${variableWithDefaults.key}. ${printGitlabError(e)}`
|
|
5482
|
+
);
|
|
5483
|
+
}
|
|
5484
|
+
}
|
|
5485
|
+
}
|
|
5146
5486
|
ctx.output("commitHash", commitResult == null ? void 0 : commitResult.commitHash);
|
|
5147
5487
|
ctx.output("remoteUrl", remoteUrl);
|
|
5148
5488
|
ctx.output("repoContentsUrl", repoContentsUrl);
|
|
@@ -5150,6 +5490,9 @@ function createPublishGitlabAction(options) {
|
|
|
5150
5490
|
}
|
|
5151
5491
|
});
|
|
5152
5492
|
}
|
|
5493
|
+
function printGitlabError(error) {
|
|
5494
|
+
return JSON.stringify({ code: error.code, message: error.description });
|
|
5495
|
+
}
|
|
5153
5496
|
|
|
5154
5497
|
const createPublishGitlabMergeRequestAction = (options) => {
|
|
5155
5498
|
const { integrations } = options;
|
|
@@ -7287,4 +7630,4 @@ exports.createRouter = createRouter;
|
|
|
7287
7630
|
exports.createWaitAction = createWaitAction;
|
|
7288
7631
|
exports.scaffolderActionRules = scaffolderActionRules;
|
|
7289
7632
|
exports.scaffolderTemplateRules = scaffolderTemplateRules;
|
|
7290
|
-
//# sourceMappingURL=router-
|
|
7633
|
+
//# sourceMappingURL=router-d7df4c2b.cjs.js.map
|