@backstage/plugin-scaffolder-backend 0.15.22 → 0.15.24-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
+ ## 0.15.24-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 2441d1cf59: chore(deps): bump `knex` from 0.95.6 to 1.0.2
8
+
9
+ This also replaces `sqlite3` with `@vscode/sqlite3` 5.0.7
10
+
11
+ - 2bd5f24043: fix for the `gitlab:publish` action to use the `oauthToken` key when creating a
12
+ `Gitlab` client. This only happens if `ctx.input.token` is provided else the key `token` will be used.
13
+ - Updated dependencies
14
+ - @backstage/backend-common@0.10.7-next.0
15
+ - @backstage/plugin-catalog-backend@0.21.3-next.0
16
+ - @backstage/plugin-scaffolder-backend-module-cookiecutter@0.1.11-next.0
17
+
18
+ ## 0.15.23
19
+
20
+ ### Patch Changes
21
+
22
+ - 2e0dbb0e50: Migrate from deprecated package @octokit/rest to octokit
23
+ - c95df1631e: Added support for templating secrets into actions input, and also added an extra `token` input argument to all publishers to provide a token that would override the `integrations.config`.
24
+ You can find more information over at [Writing Templates](https://backstage.io/docs/features/software-templates/writing-templates#using-the-users-oauth-token)
25
+ - Updated dependencies
26
+ - @backstage/plugin-catalog-backend@0.21.2
27
+ - @backstage/backend-common@0.10.6
28
+ - @backstage/plugin-scaffolder-backend-module-cookiecutter@0.1.10
29
+
30
+ ## 0.15.23-next.1
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies
35
+ - @backstage/backend-common@0.10.6-next.0
36
+ - @backstage/plugin-catalog-backend@0.21.2-next.1
37
+ - @backstage/plugin-scaffolder-backend-module-cookiecutter@0.1.10-next.1
38
+
39
+ ## 0.15.23-next.0
40
+
41
+ ### Patch Changes
42
+
43
+ - 2e0dbb0e50: Migrate from deprecated package @octokit/rest to octokit
44
+ - Updated dependencies
45
+ - @backstage/plugin-catalog-backend@0.21.2-next.0
46
+ - @backstage/plugin-scaffolder-backend-module-cookiecutter@0.1.10-next.0
47
+
3
48
  ## 0.15.22
4
49
 
5
50
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -17,7 +17,7 @@ var child_process = require('child_process');
17
17
  var stream = require('stream');
18
18
  var azureDevopsNodeApi = require('azure-devops-node-api');
19
19
  var fetch = require('node-fetch');
20
- var rest = require('@octokit/rest');
20
+ var octokit = require('octokit');
21
21
  var lodash = require('lodash');
22
22
  var octokitPluginCreatePullRequest = require('octokit-plugin-create-pull-request');
23
23
  var node = require('@gitbeaker/node');
@@ -741,7 +741,7 @@ const enableBranchProtectionOnDefaultRepoBranch = async ({
741
741
  }) => {
742
742
  const tryOnce = async () => {
743
743
  try {
744
- await client.repos.updateBranchProtection({
744
+ await client.rest.repos.updateBranchProtection({
745
745
  mediaType: {
746
746
  previews: ["luke-cage-preview"]
747
747
  },
@@ -854,8 +854,14 @@ function createPublishAzureAction(options) {
854
854
  description: `Sets the default branch on the repository. The default value is 'master'`
855
855
  },
856
856
  sourcePath: {
857
- title: "Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.",
857
+ title: "Source Path",
858
+ description: "Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.",
858
859
  type: "string"
860
+ },
861
+ token: {
862
+ title: "Authentication Token",
863
+ type: "string",
864
+ description: "The token to use for authorization to Azure"
859
865
  }
860
866
  }
861
867
  },
@@ -874,6 +880,7 @@ function createPublishAzureAction(options) {
874
880
  }
875
881
  },
876
882
  async handler(ctx) {
883
+ var _a;
877
884
  const { repoUrl, defaultBranch = "master" } = ctx.input;
878
885
  const { owner, repo, host, organization } = parseRepoUrl(repoUrl, integrations);
879
886
  if (!organization) {
@@ -883,10 +890,11 @@ function createPublishAzureAction(options) {
883
890
  if (!integrationConfig) {
884
891
  throw new errors.InputError(`No matching integration configuration for host ${host}, please check your integrations config`);
885
892
  }
886
- if (!integrationConfig.config.token) {
893
+ if (!integrationConfig.config.token && !ctx.input.token) {
887
894
  throw new errors.InputError(`No token provided for Azure Integration ${host}`);
888
895
  }
889
- const authHandler = azureDevopsNodeApi.getPersonalAccessTokenHandler(integrationConfig.config.token);
896
+ const token = (_a = ctx.input.token) != null ? _a : integrationConfig.config.token;
897
+ const authHandler = azureDevopsNodeApi.getPersonalAccessTokenHandler(token);
890
898
  const webApi = new azureDevopsNodeApi.WebApi(`https://${host}/${organization}`, authHandler);
891
899
  const client = await webApi.getGitApi();
892
900
  const createOptions = { name: repo };
@@ -910,7 +918,7 @@ function createPublishAzureAction(options) {
910
918
  defaultBranch,
911
919
  auth: {
912
920
  username: "notempty",
913
- password: integrationConfig.config.token
921
+ password: token
914
922
  },
915
923
  logger: ctx.logger,
916
924
  commitMessage: config.getOptionalString("scaffolder.defaultCommitMessage"),
@@ -1056,12 +1064,19 @@ function createPublishBitbucketAction(options) {
1056
1064
  description: `Sets the default branch on the repository. The default value is 'master'`
1057
1065
  },
1058
1066
  sourcePath: {
1059
- title: "Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.",
1067
+ title: "Source Path",
1068
+ description: "Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.",
1060
1069
  type: "string"
1061
1070
  },
1062
1071
  enableLFS: {
1063
- title: "Enable LFS for the repository. Only available for hosted Bitbucket.",
1072
+ title: "Enable LFS?",
1073
+ description: "Enable LFS for the repository. Only available for hosted Bitbucket.",
1064
1074
  type: "boolean"
1075
+ },
1076
+ token: {
1077
+ title: "Authentication Token",
1078
+ type: "string",
1079
+ description: "The token to use for authorization to BitBucket"
1065
1080
  }
1066
1081
  }
1067
1082
  },
@@ -1101,7 +1116,7 @@ function createPublishBitbucketAction(options) {
1101
1116
  if (!integrationConfig) {
1102
1117
  throw new errors.InputError(`No matching integration configuration for host ${host}, please check your integrations config`);
1103
1118
  }
1104
- const authorization = getAuthorizationHeader(integrationConfig.config);
1119
+ const authorization = getAuthorizationHeader(ctx.input.token ? { host: integrationConfig.config.host, token: ctx.input.token } : integrationConfig.config);
1105
1120
  const apiBaseUrl = integrationConfig.config.apiBaseUrl;
1106
1121
  const createMethod = host === "bitbucket.org" ? createBitbucketCloudRepository : createBitbucketServerRepository;
1107
1122
  const { remoteUrl, repoContentsUrl } = await createMethod({
@@ -1118,13 +1133,22 @@ function createPublishBitbucketAction(options) {
1118
1133
  name: config.getOptionalString("scaffolder.defaultAuthor.name"),
1119
1134
  email: config.getOptionalString("scaffolder.defaultAuthor.email")
1120
1135
  };
1136
+ let auth;
1137
+ if (ctx.input.token) {
1138
+ auth = {
1139
+ username: "x-token-auth",
1140
+ password: ctx.input.token
1141
+ };
1142
+ } else {
1143
+ auth = {
1144
+ username: integrationConfig.config.username ? integrationConfig.config.username : "x-token-auth",
1145
+ password: integrationConfig.config.appPassword ? integrationConfig.config.appPassword : (_a = integrationConfig.config.token) != null ? _a : ""
1146
+ };
1147
+ }
1121
1148
  await initRepoAndPush({
1122
1149
  dir: getRepoSourceDirectory(ctx.workspacePath, ctx.input.sourcePath),
1123
1150
  remoteUrl,
1124
- auth: {
1125
- username: integrationConfig.config.username ? integrationConfig.config.username : "x-token-auth",
1126
- password: integrationConfig.config.appPassword ? integrationConfig.config.appPassword : (_a = integrationConfig.config.token) != null ? _a : ""
1127
- },
1151
+ auth,
1128
1152
  defaultBranch,
1129
1153
  logger: ctx.logger,
1130
1154
  commitMessage: config.getOptionalString("scaffolder.defaultCommitMessage"),
@@ -1172,7 +1196,7 @@ class OctokitProvider {
1172
1196
  this.integrations = integrations;
1173
1197
  this.githubCredentialsProvider = githubCredentialsProvider || integration.DefaultGithubCredentialsProvider.fromIntegrations(this.integrations);
1174
1198
  }
1175
- async getOctokit(repoUrl) {
1199
+ async getOctokit(repoUrl, options) {
1176
1200
  var _a;
1177
1201
  const { owner, repo, host } = parseRepoUrl(repoUrl, this.integrations);
1178
1202
  if (!owner) {
@@ -1182,13 +1206,21 @@ class OctokitProvider {
1182
1206
  if (!integrationConfig) {
1183
1207
  throw new errors.InputError(`No integration for host ${host}`);
1184
1208
  }
1209
+ if (options == null ? void 0 : options.token) {
1210
+ const client2 = new octokit.Octokit({
1211
+ auth: options.token,
1212
+ baseUrl: integrationConfig.apiBaseUrl,
1213
+ previews: ["nebula-preview"]
1214
+ });
1215
+ return { client: client2, token: options.token, owner, repo };
1216
+ }
1185
1217
  const { token } = await this.githubCredentialsProvider.getCredentials({
1186
1218
  url: `https://${host}/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`
1187
1219
  });
1188
1220
  if (!token) {
1189
1221
  throw new errors.InputError(`No token available for host: ${host}, with owner ${owner}, and repo ${repo}`);
1190
1222
  }
1191
- const client = new rest.Octokit({
1223
+ const client = new octokit.Octokit({
1192
1224
  auth: token,
1193
1225
  baseUrl: integrationConfig.apiBaseUrl,
1194
1226
  previews: ["nebula-preview"]
@@ -1223,7 +1255,8 @@ function createPublishGithubAction(options) {
1223
1255
  type: "string"
1224
1256
  },
1225
1257
  requireCodeOwnerReviews: {
1226
- title: "Require an approved review in PR including files with a designated Code Owner",
1258
+ title: "Require CODEOWNER Reviews?",
1259
+ description: "Require an approved review in PR including files with a designated Code Owner",
1227
1260
  type: "boolean"
1228
1261
  },
1229
1262
  repoVisibility: {
@@ -1237,7 +1270,8 @@ function createPublishGithubAction(options) {
1237
1270
  description: `Sets the default branch on the repository. The default value is 'master'`
1238
1271
  },
1239
1272
  sourcePath: {
1240
- title: "Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.",
1273
+ title: "Source Path",
1274
+ description: "Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.",
1241
1275
  type: "string"
1242
1276
  },
1243
1277
  collaborators: {
@@ -1260,6 +1294,11 @@ function createPublishGithubAction(options) {
1260
1294
  }
1261
1295
  }
1262
1296
  },
1297
+ token: {
1298
+ title: "Authentication Token",
1299
+ type: "string",
1300
+ description: "The token to use for authorization to GitHub"
1301
+ },
1263
1302
  topics: {
1264
1303
  title: "Topics",
1265
1304
  type: "array",
@@ -1292,19 +1331,20 @@ function createPublishGithubAction(options) {
1292
1331
  repoVisibility = "private",
1293
1332
  defaultBranch = "master",
1294
1333
  collaborators,
1295
- topics
1334
+ topics,
1335
+ token: providedToken
1296
1336
  } = ctx.input;
1297
- const { client, token, owner, repo } = await octokitProvider.getOctokit(repoUrl);
1298
- const user = await client.users.getByUsername({
1337
+ const { client, token, owner, repo } = await octokitProvider.getOctokit(repoUrl, { token: providedToken });
1338
+ const user = await client.rest.users.getByUsername({
1299
1339
  username: owner
1300
1340
  });
1301
- const repoCreationPromise = user.data.type === "Organization" ? client.repos.createInOrg({
1341
+ const repoCreationPromise = user.data.type === "Organization" ? client.rest.repos.createInOrg({
1302
1342
  name: repo,
1303
1343
  org: owner,
1304
1344
  private: repoVisibility === "private",
1305
1345
  visibility: repoVisibility,
1306
1346
  description
1307
- }) : client.repos.createForAuthenticatedUser({
1347
+ }) : client.rest.repos.createForAuthenticatedUser({
1308
1348
  name: repo,
1309
1349
  private: repoVisibility === "private",
1310
1350
  description
@@ -1312,7 +1352,7 @@ function createPublishGithubAction(options) {
1312
1352
  const { data: newRepo } = await repoCreationPromise;
1313
1353
  if (access == null ? void 0 : access.startsWith(`${owner}/`)) {
1314
1354
  const [, team] = access.split("/");
1315
- await client.teams.addOrUpdateRepoPermissionsInOrg({
1355
+ await client.rest.teams.addOrUpdateRepoPermissionsInOrg({
1316
1356
  org: owner,
1317
1357
  team_slug: team,
1318
1358
  owner,
@@ -1320,7 +1360,7 @@ function createPublishGithubAction(options) {
1320
1360
  permission: "admin"
1321
1361
  });
1322
1362
  } else if (access && access !== owner) {
1323
- await client.repos.addCollaborator({
1363
+ await client.rest.repos.addCollaborator({
1324
1364
  owner,
1325
1365
  repo,
1326
1366
  username: access,
@@ -1333,7 +1373,7 @@ function createPublishGithubAction(options) {
1333
1373
  username: team_slug
1334
1374
  } of collaborators) {
1335
1375
  try {
1336
- await client.teams.addOrUpdateRepoPermissionsInOrg({
1376
+ await client.rest.teams.addOrUpdateRepoPermissionsInOrg({
1337
1377
  org: owner,
1338
1378
  team_slug,
1339
1379
  owner,
@@ -1348,7 +1388,7 @@ function createPublishGithubAction(options) {
1348
1388
  }
1349
1389
  if (topics) {
1350
1390
  try {
1351
- await client.repos.replaceAllTopics({
1391
+ await client.rest.repos.replaceAllTopics({
1352
1392
  owner,
1353
1393
  repo,
1354
1394
  names: topics.map((t) => t.toLowerCase())
@@ -1402,13 +1442,21 @@ const defaultClientFactory = async ({
1402
1442
  githubCredentialsProvider,
1403
1443
  owner,
1404
1444
  repo,
1405
- host = "github.com"
1445
+ host = "github.com",
1446
+ token: providedToken
1406
1447
  }) => {
1407
1448
  var _a;
1408
1449
  const integrationConfig = (_a = integrations.github.byHost(host)) == null ? void 0 : _a.config;
1450
+ const OctokitPR = octokit.Octokit.plugin(octokitPluginCreatePullRequest.createPullRequest);
1409
1451
  if (!integrationConfig) {
1410
1452
  throw new errors.InputError(`No integration for host ${host}`);
1411
1453
  }
1454
+ if (providedToken) {
1455
+ return new OctokitPR({
1456
+ auth: providedToken,
1457
+ baseUrl: integrationConfig.apiBaseUrl
1458
+ });
1459
+ }
1412
1460
  const credentialsProvider = githubCredentialsProvider || integration.SingleInstanceGithubCredentialsProvider.create(integrationConfig);
1413
1461
  const { token } = await credentialsProvider.getCredentials({
1414
1462
  url: `https://${host}/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`
@@ -1416,7 +1464,6 @@ const defaultClientFactory = async ({
1416
1464
  if (!token) {
1417
1465
  throw new errors.InputError(`No token available for host: ${host}, with owner ${owner}, and repo ${repo}`);
1418
1466
  }
1419
- const OctokitPR = rest.Octokit.plugin(octokitPluginCreatePullRequest.createPullRequest);
1420
1467
  return new OctokitPR({
1421
1468
  auth: token,
1422
1469
  baseUrl: integrationConfig.apiBaseUrl
@@ -1463,6 +1510,11 @@ const createPublishGithubPullRequestAction = ({
1463
1510
  type: "string",
1464
1511
  title: "Repository Subdirectory",
1465
1512
  description: "Subdirectory of repository to apply changes to"
1513
+ },
1514
+ token: {
1515
+ title: "Authentication Token",
1516
+ type: "string",
1517
+ description: "The token to use for authorization to GitHub"
1466
1518
  }
1467
1519
  }
1468
1520
  },
@@ -1485,7 +1537,8 @@ const createPublishGithubPullRequestAction = ({
1485
1537
  title,
1486
1538
  description,
1487
1539
  targetPath,
1488
- sourcePath
1540
+ sourcePath,
1541
+ token: providedToken
1489
1542
  } = ctx.input;
1490
1543
  const { owner, repo, host } = parseRepoUrl(repoUrl, integrations);
1491
1544
  if (!owner) {
@@ -1496,7 +1549,8 @@ const createPublishGithubPullRequestAction = ({
1496
1549
  githubCredentialsProvider,
1497
1550
  host,
1498
1551
  owner,
1499
- repo
1552
+ repo,
1553
+ token: providedToken
1500
1554
  });
1501
1555
  const fileRoot = sourcePath ? backendCommon.resolveSafeChildPath(ctx.workspacePath, sourcePath) : ctx.workspacePath;
1502
1556
  const localFilePaths = await globby__default["default"](["./**", "./**/.*", "!.git"], {
@@ -1570,8 +1624,14 @@ function createPublishGitlabAction(options) {
1570
1624
  description: `Sets the default branch on the repository. The default value is 'master'`
1571
1625
  },
1572
1626
  sourcePath: {
1573
- title: "Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.",
1627
+ title: "Source Path",
1628
+ description: "Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.",
1574
1629
  type: "string"
1630
+ },
1631
+ token: {
1632
+ title: "Authentication Token",
1633
+ type: "string",
1634
+ description: "The token to use for authorization to GitLab"
1575
1635
  }
1576
1636
  }
1577
1637
  },
@@ -1603,12 +1663,14 @@ function createPublishGitlabAction(options) {
1603
1663
  if (!integrationConfig) {
1604
1664
  throw new errors.InputError(`No matching integration configuration for host ${host}, please check your integrations config`);
1605
1665
  }
1606
- if (!integrationConfig.config.token) {
1666
+ if (!integrationConfig.config.token && !ctx.input.token) {
1607
1667
  throw new errors.InputError(`No token available for host ${host}`);
1608
1668
  }
1669
+ const token = ctx.input.token || integrationConfig.config.token;
1670
+ const tokenType = ctx.input.token ? "oauthToken" : "token";
1609
1671
  const client = new node.Gitlab({
1610
1672
  host: integrationConfig.config.baseUrl,
1611
- token: integrationConfig.config.token
1673
+ [tokenType]: token
1612
1674
  });
1613
1675
  let { id: targetNamespace } = await client.Namespaces.show(owner);
1614
1676
  if (!targetNamespace) {
@@ -1632,7 +1694,7 @@ function createPublishGitlabAction(options) {
1632
1694
  defaultBranch,
1633
1695
  auth: {
1634
1696
  username: "oauth2",
1635
- password: integrationConfig.config.token
1697
+ password: token
1636
1698
  },
1637
1699
  logger: ctx.logger,
1638
1700
  commitMessage: config.getOptionalString("scaffolder.defaultCommitMessage"),
@@ -1682,6 +1744,11 @@ const createPublishGitlabMergeRequestAction = (options) => {
1682
1744
  type: "string",
1683
1745
  title: "Repository Subdirectory",
1684
1746
  description: "Subdirectory of repository to apply changes to"
1747
+ },
1748
+ token: {
1749
+ title: "Authentication Token",
1750
+ type: "string",
1751
+ description: "The token to use for authorization to GitLab"
1685
1752
  }
1686
1753
  }
1687
1754
  },
@@ -1701,6 +1768,7 @@ const createPublishGitlabMergeRequestAction = (options) => {
1701
1768
  }
1702
1769
  },
1703
1770
  async handler(ctx) {
1771
+ var _a;
1704
1772
  const repoUrl = ctx.input.repoUrl;
1705
1773
  const { host } = parseRepoUrl(repoUrl, integrations);
1706
1774
  const integrationConfig = integrations.gitlab.byHost(host);
@@ -1709,12 +1777,14 @@ const createPublishGitlabMergeRequestAction = (options) => {
1709
1777
  if (!integrationConfig) {
1710
1778
  throw new errors.InputError(`No matching integration configuration for host ${host}, please check your integrations config`);
1711
1779
  }
1712
- if (!integrationConfig.config.token) {
1780
+ if (!integrationConfig.config.token && !ctx.input.token) {
1713
1781
  throw new errors.InputError(`No token available for host ${host}`);
1714
1782
  }
1783
+ const token = (_a = ctx.input.token) != null ? _a : integrationConfig.config.token;
1784
+ const tokenType = ctx.input.token ? "oauthToken" : "token";
1715
1785
  const api = new node.Gitlab({
1716
1786
  host: integrationConfig.config.baseUrl,
1717
- token: integrationConfig.config.token
1787
+ [tokenType]: token
1718
1788
  });
1719
1789
  const fileRoot = ctx.workspacePath;
1720
1790
  const localFilePaths = await globby__default["default"]([`${ctx.input.targetPath}/**`], {
@@ -1788,14 +1858,25 @@ function createGithubActionsDispatchAction(options) {
1788
1858
  title: "Workflow Inputs",
1789
1859
  description: "Inputs keys and values to send to GitHub Action configured on the workflow file. The maximum number of properties is 10. ",
1790
1860
  type: "object"
1861
+ },
1862
+ token: {
1863
+ title: "Authentication Token",
1864
+ type: "string",
1865
+ description: "The GITHUB_TOKEN to use for authorization to GitHub"
1791
1866
  }
1792
1867
  }
1793
1868
  }
1794
1869
  },
1795
1870
  async handler(ctx) {
1796
- const { repoUrl, workflowId, branchOrTagName, workflowInputs } = ctx.input;
1871
+ const {
1872
+ repoUrl,
1873
+ workflowId,
1874
+ branchOrTagName,
1875
+ workflowInputs,
1876
+ token: providedToken
1877
+ } = ctx.input;
1797
1878
  ctx.logger.info(`Dispatching workflow ${workflowId} for repo ${repoUrl} on ${branchOrTagName}`);
1798
- const { client, owner, repo } = await octokitProvider.getOctokit(repoUrl);
1879
+ const { client, owner, repo } = await octokitProvider.getOctokit(repoUrl, { token: providedToken });
1799
1880
  await client.rest.actions.createWorkflowDispatch({
1800
1881
  owner,
1801
1882
  repo,
@@ -1869,6 +1950,11 @@ function createGithubWebhookAction(options) {
1869
1950
  title: "Insecure SSL",
1870
1951
  type: "boolean",
1871
1952
  description: `Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Default 'false'`
1953
+ },
1954
+ token: {
1955
+ title: "Authentication Token",
1956
+ type: "string",
1957
+ description: "The GITHUB_TOKEN to use for authorization to GitHub"
1872
1958
  }
1873
1959
  }
1874
1960
  }
@@ -1881,13 +1967,14 @@ function createGithubWebhookAction(options) {
1881
1967
  events = ["push"],
1882
1968
  active = true,
1883
1969
  contentType = "form",
1884
- insecureSsl = false
1970
+ insecureSsl = false,
1971
+ token: providedToken
1885
1972
  } = ctx.input;
1886
1973
  ctx.logger.info(`Creating webhook ${webhookUrl} for repo ${repoUrl}`);
1887
- const { client, owner, repo } = await octokitProvider.getOctokit(repoUrl);
1974
+ const { client, owner, repo } = await octokitProvider.getOctokit(repoUrl, { token: providedToken });
1888
1975
  try {
1889
1976
  const insecure_ssl = insecureSsl ? "1" : "0";
1890
- await client.repos.createWebhook({
1977
+ await client.rest.repos.createWebhook({
1891
1978
  owner,
1892
1979
  repo,
1893
1980
  config: {
@@ -2557,7 +2644,7 @@ class NunjucksWorkflowRunner {
2557
2644
  });
2558
2645
  }
2559
2646
  async execute(task) {
2560
- var _a, _b, _c, _d;
2647
+ var _a, _b, _c, _d, _e;
2561
2648
  if (!isValidTaskSpec(task.spec)) {
2562
2649
  throw new errors.InputError("Wrong template version executed with the workflow engine");
2563
2650
  }
@@ -2591,8 +2678,8 @@ class NunjucksWorkflowRunner {
2591
2678
  });
2592
2679
  const action = this.options.actionRegistry.get(step.action);
2593
2680
  const { taskLogger, streamLogger } = createStepLogger({ task, step });
2594
- const input = (_a = step.input && this.render(step.input, context, renderTemplate)) != null ? _a : {};
2595
- if ((_b = action.schema) == null ? void 0 : _b.input) {
2681
+ const input = (_b = step.input && this.render(step.input, { ...context, secrets: (_a = task.secrets) != null ? _a : {} }, renderTemplate)) != null ? _b : {};
2682
+ if ((_c = action.schema) == null ? void 0 : _c.input) {
2596
2683
  const validateResult = jsonschema.validate(input, action.schema.input);
2597
2684
  if (!validateResult.valid) {
2598
2685
  const errors$1 = validateResult.errors.join(", ");
@@ -2607,8 +2694,8 @@ class NunjucksWorkflowRunner {
2607
2694
  await action.handler({
2608
2695
  baseUrl: task.spec.baseUrl,
2609
2696
  input,
2610
- token: (_c = task.secrets) == null ? void 0 : _c.token,
2611
- secrets: (_d = task.secrets) != null ? _d : {},
2697
+ token: (_d = task.secrets) == null ? void 0 : _d.token,
2698
+ secrets: (_e = task.secrets) != null ? _e : {},
2612
2699
  logger: taskLogger,
2613
2700
  logStream: streamLogger,
2614
2701
  workspacePath,