@backstage/plugin-scaffolder-backend-module-github 0.0.0-nightly-20260313031005 → 0.0.0-nightly-20260314030835
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 +6 -5
- package/dist/actions/githubActionsDispatch.cjs.js +53 -13
- package/dist/actions/githubActionsDispatch.cjs.js.map +1 -1
- package/dist/actions/githubActionsDispatch.examples.cjs.js +17 -0
- package/dist/actions/githubActionsDispatch.examples.cjs.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend-module-github
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-20260314030835
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
+
- a761a48: Added optional `returnWorkflowRunDetails` input to `github:actions:dispatch` action. When true, exposes `workflowRunId`, `workflowRunUrl`, and `workflowRunHtmlUrl` as outputs using the GitHub API `return_run_details` parameter.
|
|
7
8
|
- b2591f6: Fixed environment `waitTime` description incorrectly asking for milliseconds instead of minutes.
|
|
8
9
|
- Updated dependencies
|
|
9
|
-
- @backstage/backend-plugin-api@0.0.0-nightly-
|
|
10
|
-
- @backstage/
|
|
11
|
-
- @backstage/
|
|
12
|
-
- @backstage/plugin-
|
|
10
|
+
- @backstage/backend-plugin-api@0.0.0-nightly-20260314030835
|
|
11
|
+
- @backstage/plugin-scaffolder-node@0.0.0-nightly-20260314030835
|
|
12
|
+
- @backstage/integration@0.0.0-nightly-20260314030835
|
|
13
|
+
- @backstage/plugin-catalog-node@0.0.0-nightly-20260314030835
|
|
13
14
|
- @backstage/catalog-model@1.7.6
|
|
14
15
|
- @backstage/config@1.3.6
|
|
15
16
|
- @backstage/errors@1.2.7
|
|
@@ -24,11 +24,19 @@ function createGithubActionsDispatchAction(options) {
|
|
|
24
24
|
description: "The git branch or tag name used to dispatch the workflow"
|
|
25
25
|
}),
|
|
26
26
|
workflowInputs: (z) => z.record(z.string(), {
|
|
27
|
-
description: "Inputs keys and values to send to GitHub Action configured on the workflow file. The maximum number of properties is
|
|
27
|
+
description: "Inputs keys and values to send to GitHub Action configured on the workflow file. The maximum number of properties is 25."
|
|
28
|
+
}).optional(),
|
|
29
|
+
returnWorkflowRunDetails: (z) => z.boolean({
|
|
30
|
+
description: "If true, returns the workflow run ID and URLs as action outputs."
|
|
28
31
|
}).optional(),
|
|
29
32
|
token: (z) => z.string({
|
|
30
33
|
description: "The `GITHUB_TOKEN` to use for authorization to GitHub"
|
|
31
34
|
}).optional()
|
|
35
|
+
},
|
|
36
|
+
output: {
|
|
37
|
+
workflowRunId: (z) => z.number({ description: "The triggered workflow run ID" }).optional(),
|
|
38
|
+
workflowRunUrl: (z) => z.string({ description: "API URL of the workflow run" }).optional(),
|
|
39
|
+
workflowRunHtmlUrl: (z) => z.string({ description: "HTML URL of the workflow run" }).optional()
|
|
32
40
|
}
|
|
33
41
|
},
|
|
34
42
|
async handler(ctx) {
|
|
@@ -37,6 +45,7 @@ function createGithubActionsDispatchAction(options) {
|
|
|
37
45
|
workflowId,
|
|
38
46
|
branchOrTagName,
|
|
39
47
|
workflowInputs,
|
|
48
|
+
returnWorkflowRunDetails,
|
|
40
49
|
token: providedToken
|
|
41
50
|
} = ctx.input;
|
|
42
51
|
ctx.logger.info(
|
|
@@ -58,19 +67,50 @@ function createGithubActionsDispatchAction(options) {
|
|
|
58
67
|
...octokitOptions,
|
|
59
68
|
log: ctx.logger
|
|
60
69
|
});
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
try {
|
|
71
|
+
const runDetails = await ctx.checkpoint({
|
|
72
|
+
key: `create.workflow.dispatch.${owner}.${repo}.${workflowId}`,
|
|
73
|
+
fn: async () => {
|
|
74
|
+
const dispatchParams = {
|
|
75
|
+
owner,
|
|
76
|
+
repo,
|
|
77
|
+
workflow_id: workflowId,
|
|
78
|
+
ref: branchOrTagName,
|
|
79
|
+
inputs: workflowInputs,
|
|
80
|
+
...returnWorkflowRunDetails ? { return_run_details: true } : {}
|
|
81
|
+
};
|
|
82
|
+
const response = await client.rest.actions.createWorkflowDispatch(
|
|
83
|
+
dispatchParams
|
|
84
|
+
);
|
|
85
|
+
ctx.logger.info(`Workflow ${workflowId} dispatched successfully`);
|
|
86
|
+
if (returnWorkflowRunDetails && response.data) {
|
|
87
|
+
const data = response.data;
|
|
88
|
+
return {
|
|
89
|
+
workflowRunId: data.workflow_run_id,
|
|
90
|
+
workflowRunUrl: data.run_url,
|
|
91
|
+
workflowRunHtmlUrl: data.html_url
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
if (runDetails) {
|
|
98
|
+
ctx.output("workflowRunId", runDetails.workflowRunId);
|
|
99
|
+
ctx.output("workflowRunUrl", runDetails.workflowRunUrl);
|
|
100
|
+
ctx.output("workflowRunHtmlUrl", runDetails.workflowRunHtmlUrl);
|
|
101
|
+
if (runDetails.workflowRunHtmlUrl) {
|
|
102
|
+
ctx.logger.info(
|
|
103
|
+
`Workflow run url: ${runDetails.workflowRunHtmlUrl}`
|
|
104
|
+
);
|
|
105
|
+
}
|
|
72
106
|
}
|
|
73
|
-
})
|
|
107
|
+
} catch (e) {
|
|
108
|
+
errors.assertError(e);
|
|
109
|
+
ctx.logger.warn(
|
|
110
|
+
`Failed: dispatching workflow '${workflowId}' on repo: '${repo}', ${e.message}`
|
|
111
|
+
);
|
|
112
|
+
throw e;
|
|
113
|
+
}
|
|
74
114
|
}
|
|
75
115
|
});
|
|
76
116
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubActionsDispatch.cjs.js","sources":["../../src/actions/githubActionsDispatch.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 { InputError } from '@backstage/errors';\nimport {\n GithubCredentialsProvider,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { Octokit } from 'octokit';\nimport { getOctokitOptions } from '../util';\nimport { examples } from './githubActionsDispatch.examples';\n\n/**\n * Creates a new action that dispatches a GitHub Action workflow for a given branch or tag.\n * @public\n */\nexport function createGithubActionsDispatchAction(options: {\n integrations: ScmIntegrations;\n githubCredentialsProvider?: GithubCredentialsProvider;\n}) {\n const { integrations, githubCredentialsProvider } = options;\n\n return createTemplateAction({\n id: 'github:actions:dispatch',\n description:\n 'Dispatches a GitHub Action workflow for a given branch or tag',\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 new repository name and `owner` is an organization or username',\n }),\n workflowId: z =>\n z.string({\n description: 'The GitHub Action Workflow filename',\n }),\n branchOrTagName: z =>\n z.string({\n description:\n 'The git branch or tag name used to dispatch the workflow',\n }),\n workflowInputs: z =>\n z\n .record(z.string(), {\n description:\n 'Inputs keys and values to send to GitHub Action configured on the workflow file. The maximum number of properties is
|
|
1
|
+
{"version":3,"file":"githubActionsDispatch.cjs.js","sources":["../../src/actions/githubActionsDispatch.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 { assertError, InputError } from '@backstage/errors';\nimport {\n GithubCredentialsProvider,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { Octokit } from 'octokit';\nimport { getOctokitOptions } from '../util';\nimport { examples } from './githubActionsDispatch.examples';\n\n/**\n * Creates a new action that dispatches a GitHub Action workflow for a given branch or tag.\n * @public\n */\nexport function createGithubActionsDispatchAction(options: {\n integrations: ScmIntegrations;\n githubCredentialsProvider?: GithubCredentialsProvider;\n}) {\n const { integrations, githubCredentialsProvider } = options;\n\n return createTemplateAction({\n id: 'github:actions:dispatch',\n description:\n 'Dispatches a GitHub Action workflow for a given branch or tag',\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 new repository name and `owner` is an organization or username',\n }),\n workflowId: z =>\n z.string({\n description: 'The GitHub Action Workflow filename',\n }),\n branchOrTagName: z =>\n z.string({\n description:\n 'The git branch or tag name used to dispatch the workflow',\n }),\n workflowInputs: z =>\n z\n .record(z.string(), {\n description:\n 'Inputs keys and values to send to GitHub Action configured on the workflow file. The maximum number of properties is 25.',\n })\n .optional(),\n returnWorkflowRunDetails: z =>\n z\n .boolean({\n description:\n 'If true, returns the workflow run ID and URLs as action outputs.',\n })\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 output: {\n workflowRunId: z =>\n z.number({ description: 'The triggered workflow run ID' }).optional(),\n workflowRunUrl: z =>\n z.string({ description: 'API URL of the workflow run' }).optional(),\n workflowRunHtmlUrl: z =>\n z.string({ description: 'HTML URL of the workflow run' }).optional(),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n workflowId,\n branchOrTagName,\n workflowInputs,\n returnWorkflowRunDetails,\n token: providedToken,\n } = ctx.input;\n\n ctx.logger.info(\n `Dispatching workflow ${workflowId} for repo ${repoUrl} on ${branchOrTagName}`,\n );\n\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 host,\n owner,\n repo,\n credentialsProvider: githubCredentialsProvider,\n token: providedToken,\n });\n const client = new Octokit({\n ...octokitOptions,\n log: ctx.logger,\n });\n\n try {\n const runDetails = await ctx.checkpoint({\n key: `create.workflow.dispatch.${owner}.${repo}.${workflowId}`,\n fn: async () => {\n const dispatchParams = {\n owner,\n repo,\n workflow_id: workflowId,\n ref: branchOrTagName,\n inputs: workflowInputs,\n ...(returnWorkflowRunDetails ? { return_run_details: true } : {}),\n };\n const response = await client.rest.actions.createWorkflowDispatch(\n dispatchParams,\n );\n\n ctx.logger.info(`Workflow ${workflowId} dispatched successfully`);\n\n if (returnWorkflowRunDetails && response.data) {\n // GitHub's API returns 200 with run details when return_run_details is true.\n // @octokit/openapi-types still types this as OctokitResponse<never, 204> because\n // it hasn't picked up the updated GitHub OpenAPI spec yet.\n // See: https://github.blog/changelog/2026-02-19-workflow-dispatch-api-now-returns-run-ids/\n // This cast can be removed once @octokit/openapi-types includes the updated spec.\n // Note: only supported on GitHub.com and GitHub Enterprise Cloud, not GitHub Enterprise Server\n const data = response.data as unknown as {\n workflow_run_id: number;\n run_url: string;\n html_url: string;\n };\n\n return {\n workflowRunId: data.workflow_run_id,\n workflowRunUrl: data.run_url,\n workflowRunHtmlUrl: data.html_url,\n };\n }\n return null;\n },\n });\n\n if (runDetails) {\n ctx.output('workflowRunId', runDetails.workflowRunId);\n ctx.output('workflowRunUrl', runDetails.workflowRunUrl);\n ctx.output('workflowRunHtmlUrl', runDetails.workflowRunHtmlUrl);\n\n if (runDetails.workflowRunHtmlUrl) {\n ctx.logger.info(\n `Workflow run url: ${runDetails.workflowRunHtmlUrl}`,\n );\n }\n }\n } catch (e) {\n assertError(e);\n ctx.logger.warn(\n `Failed: dispatching workflow '${workflowId}' on repo: '${repo}', ${e.message}`,\n );\n throw e;\n }\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","getOctokitOptions","Octokit","assertError"],"mappings":";;;;;;;;AAiCO,SAAS,kCAAkC,OAAA,EAG/C;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,yBAAA,EAA0B,GAAI,OAAA;AAEpD,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,yBAAA;AAAA,IACJ,WAAA,EACE,+DAAA;AAAA,cACFC,uCAAA;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,UAAA,EAAY,CAAA,CAAA,KACV,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa;AAAA,SACd,CAAA;AAAA,QACH,eAAA,EAAiB,CAAA,CAAA,KACf,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EACE;AAAA,SACH,CAAA;AAAA,QACH,gBAAgB,CAAA,CAAA,KACd,CAAA,CACG,MAAA,CAAO,CAAA,CAAE,QAAO,EAAG;AAAA,UAClB,WAAA,EACE;AAAA,SACH,EACA,QAAA,EAAS;AAAA,QACd,wBAAA,EAA0B,CAAA,CAAA,KACxB,CAAA,CACG,OAAA,CAAQ;AAAA,UACP,WAAA,EACE;AAAA,SACH,EACA,QAAA,EAAS;AAAA,QACd,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CACG,MAAA,CAAO;A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AACjC,YAAA,GAAA,CAAI,MAAA,CAAO,IAAA;AAAA,cACT,CAAA,kBAAA,EAAqB,WAAW,kBAAkB,CAAA;AAAA,aACpD;AAAA,UACF;AAAA,QACF;AAAA,MACF,SAAS,CAAA,EAAG;AACV,QAAAC,kBAAA,CAAY,CAAC,CAAA;AACb,QAAA,GAAA,CAAI,MAAA,CAAO,IAAA;AAAA,UACT,iCAAiC,UAAU,CAAA,YAAA,EAAe,IAAI,CAAA,GAAA,EAAM,EAAE,OAAO,CAAA;AAAA,SAC/E;AACA,QAAA,MAAM,CAAA;AAAA,MACR;AAAA,IACF;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -59,6 +59,23 @@ const examples = [
|
|
|
59
59
|
}
|
|
60
60
|
]
|
|
61
61
|
})
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
description: "GitHub Action Workflow returning run details",
|
|
65
|
+
example: yaml__default.default.stringify({
|
|
66
|
+
steps: [
|
|
67
|
+
{
|
|
68
|
+
action: "github:actions:dispatch",
|
|
69
|
+
name: "Dispatch GitHub Action Workflow and get run ID",
|
|
70
|
+
input: {
|
|
71
|
+
repoUrl: "github.com?repo=repo&owner=owner",
|
|
72
|
+
workflowId: "WORKFLOW_ID",
|
|
73
|
+
branchOrTagName: "main",
|
|
74
|
+
returnWorkflowRunDetails: true
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
})
|
|
62
79
|
}
|
|
63
80
|
];
|
|
64
81
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubActionsDispatch.examples.cjs.js","sources":["../../src/actions/githubActionsDispatch.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 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: 'GitHub Action Workflow Without Inputs.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:actions:dispatch',\n name: 'Dispatch Github Action Workflow',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n workflowId: 'WORKFLOW_ID',\n branchOrTagName: 'main',\n },\n },\n ],\n }),\n },\n {\n description: 'GitHub Action Workflow With Inputs',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:actions:dispatch',\n name: 'Dispatch Github Action Workflow with inputs',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n workflowId: 'WORKFLOW_ID',\n branchOrTagName: 'main',\n workflowInputs: {\n input1: 'value1',\n input2: 'value2',\n },\n },\n },\n ],\n }),\n },\n {\n description: 'GitHub Action Workflow With Custom Token',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:actions:dispatch',\n name: 'Dispatch GitHub Action Workflow (custom token)',\n input: {\n repoUrl: 'github.com?repo=reponame&owner=owner',\n workflowId: 'WORKFLOW_ID',\n branchOrTagName: 'release-1.0',\n token: '${{ secrets.MY_CUSTOM_TOKEN }}',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,wCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,yBAAA;AAAA,UACR,IAAA,EAAM,iCAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,UAAA,EAAY,aAAA;AAAA,YACZ,eAAA,EAAiB;AAAA;AACnB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,oCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,yBAAA;AAAA,UACR,IAAA,EAAM,6CAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,UAAA,EAAY,aAAA;AAAA,YACZ,eAAA,EAAiB,MAAA;AAAA,YACjB,cAAA,EAAgB;AAAA,cACd,MAAA,EAAQ,QAAA;AAAA,cACR,MAAA,EAAQ;AAAA;AACV;AACF;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,0CAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,yBAAA;AAAA,UACR,IAAA,EAAM,gDAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,sCAAA;AAAA,YACT,UAAA,EAAY,aAAA;AAAA,YACZ,eAAA,EAAiB,aAAA;AAAA,YACjB,KAAA,EAAO;AAAA;AACT;AACF;AACF,KACD;AAAA;AAEL;;;;"}
|
|
1
|
+
{"version":3,"file":"githubActionsDispatch.examples.cjs.js","sources":["../../src/actions/githubActionsDispatch.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 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: 'GitHub Action Workflow Without Inputs.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:actions:dispatch',\n name: 'Dispatch Github Action Workflow',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n workflowId: 'WORKFLOW_ID',\n branchOrTagName: 'main',\n },\n },\n ],\n }),\n },\n {\n description: 'GitHub Action Workflow With Inputs',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:actions:dispatch',\n name: 'Dispatch Github Action Workflow with inputs',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n workflowId: 'WORKFLOW_ID',\n branchOrTagName: 'main',\n workflowInputs: {\n input1: 'value1',\n input2: 'value2',\n },\n },\n },\n ],\n }),\n },\n {\n description: 'GitHub Action Workflow With Custom Token',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:actions:dispatch',\n name: 'Dispatch GitHub Action Workflow (custom token)',\n input: {\n repoUrl: 'github.com?repo=reponame&owner=owner',\n workflowId: 'WORKFLOW_ID',\n branchOrTagName: 'release-1.0',\n token: '${{ secrets.MY_CUSTOM_TOKEN }}',\n },\n },\n ],\n }),\n },\n {\n description: 'GitHub Action Workflow returning run details',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:actions:dispatch',\n name: 'Dispatch GitHub Action Workflow and get run ID',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n workflowId: 'WORKFLOW_ID',\n branchOrTagName: 'main',\n returnWorkflowRunDetails: true,\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,wCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,yBAAA;AAAA,UACR,IAAA,EAAM,iCAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,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
CHANGED
|
@@ -19,9 +19,12 @@ declare function createGithubActionsDispatchAction(options: {
|
|
|
19
19
|
workflowId: string;
|
|
20
20
|
branchOrTagName: string;
|
|
21
21
|
workflowInputs?: Record<string, string> | undefined;
|
|
22
|
+
returnWorkflowRunDetails?: boolean | undefined;
|
|
22
23
|
token?: string | undefined;
|
|
23
24
|
}, {
|
|
24
|
-
|
|
25
|
+
workflowRunId?: number | undefined;
|
|
26
|
+
workflowRunUrl?: string | undefined;
|
|
27
|
+
workflowRunHtmlUrl?: string | undefined;
|
|
25
28
|
}, "v2">;
|
|
26
29
|
|
|
27
30
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-backend-module-github",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20260314030835",
|
|
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": "0.0.0-nightly-
|
|
53
|
+
"@backstage/backend-plugin-api": "0.0.0-nightly-20260314030835",
|
|
54
54
|
"@backstage/catalog-model": "1.7.6",
|
|
55
55
|
"@backstage/config": "1.3.6",
|
|
56
56
|
"@backstage/errors": "1.2.7",
|
|
57
|
-
"@backstage/integration": "0.0.0-nightly-
|
|
58
|
-
"@backstage/plugin-catalog-node": "0.0.0-nightly-
|
|
59
|
-
"@backstage/plugin-scaffolder-node": "0.0.0-nightly-
|
|
57
|
+
"@backstage/integration": "0.0.0-nightly-20260314030835",
|
|
58
|
+
"@backstage/plugin-catalog-node": "0.0.0-nightly-20260314030835",
|
|
59
|
+
"@backstage/plugin-scaffolder-node": "0.0.0-nightly-20260314030835",
|
|
60
60
|
"@backstage/types": "1.2.2",
|
|
61
61
|
"@octokit/webhooks": "^10.9.2",
|
|
62
62
|
"libsodium-wrappers": "^0.8.0",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
"zod": "^3.25.76"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@backstage/backend-test-utils": "0.0.0-nightly-
|
|
70
|
-
"@backstage/cli": "0.0.0-nightly-
|
|
71
|
-
"@backstage/plugin-scaffolder-node-test-utils": "0.0.0-nightly-
|
|
69
|
+
"@backstage/backend-test-utils": "0.0.0-nightly-20260314030835",
|
|
70
|
+
"@backstage/cli": "0.0.0-nightly-20260314030835",
|
|
71
|
+
"@backstage/plugin-scaffolder-node-test-utils": "0.0.0-nightly-20260314030835",
|
|
72
72
|
"@types/libsodium-wrappers": "^0.8.0",
|
|
73
73
|
"fs-extra": "^11.2.0",
|
|
74
74
|
"jsonschema": "^1.2.6"
|