@backstage/plugin-scaffolder-backend-module-github 0.9.9-next.0 → 0.9.10-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,30 @@
1
1
  # @backstage/plugin-scaffolder-backend-module-github
2
2
 
3
+ ## 0.9.10-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/integration@2.0.3-next.0
9
+ - @backstage/plugin-catalog-node@2.2.2-next.0
10
+ - @backstage/plugin-scaffolder-node@0.13.4-next.0
11
+ - @backstage/backend-plugin-api@1.9.2-next.0
12
+
13
+ ## 0.9.9
14
+
15
+ ### Patch Changes
16
+
17
+ - 3846774: Added missing dependencies that were previously only available transitively.
18
+ - a2ee960: Improved Octokit client creation to support retries via @octokit/plugin-retry
19
+ - Updated dependencies
20
+ - @backstage/catalog-model@1.9.0
21
+ - @backstage/errors@1.3.1
22
+ - @backstage/backend-plugin-api@1.9.1
23
+ - @backstage/plugin-catalog-node@2.2.1
24
+ - @backstage/integration@2.0.2
25
+ - @backstage/plugin-scaffolder-node@0.13.3
26
+ - @backstage/config@1.3.8
27
+
3
28
  ## 0.9.9-next.0
4
29
 
5
30
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -34,5 +34,6 @@ exports.createGithubAutolinksAction = githubAutolinks.createGithubAutolinksActio
34
34
  exports.createGithubPagesEnableAction = githubPagesEnable.createGithubPagesEnableAction;
35
35
  exports.createGithubBranchProtectionAction = githubBranchProtection.createGithubBranchProtectionAction;
36
36
  exports.default = module$1.githubModule;
37
+ exports.getOctokitClient = util.getOctokitClient;
37
38
  exports.getOctokitOptions = util.getOctokitOptions;
38
39
  //# sourceMappingURL=index.cjs.js.map
@@ -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
@@ -5,6 +5,7 @@ import { CatalogService } from '@backstage/plugin-catalog-node';
5
5
  import { Octokit } from 'octokit';
6
6
  import { createPullRequest } from 'octokit-plugin-create-pull-request';
7
7
  import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
8
+ import { LoggerService } from '@backstage/backend-plugin-api';
8
9
  import { OctokitOptions } from '@octokit/core/dist-types/types';
9
10
 
10
11
  /**
@@ -83,9 +84,9 @@ declare function createGithubRepoCreateAction(options: {
83
84
  blockCreations?: boolean | undefined;
84
85
  branch?: string | undefined;
85
86
  bypassPullRequestAllowances?: {
87
+ users?: string[] | undefined;
86
88
  apps?: string[] | undefined;
87
89
  teams?: string[] | undefined;
88
- users?: string[] | undefined;
89
90
  } | undefined;
90
91
  collaborators?: ({
91
92
  user: string;
@@ -123,8 +124,8 @@ declare function createGithubRepoCreateAction(options: {
123
124
  requiredStatusCheckContexts?: string[] | undefined;
124
125
  requireLastPushApproval?: boolean | undefined;
125
126
  restrictions?: {
126
- teams: string[];
127
127
  users: string[];
128
+ teams: string[];
128
129
  apps?: string[] | undefined;
129
130
  } | undefined;
130
131
  secrets?: Record<string, string> | undefined;
@@ -156,14 +157,14 @@ declare function createGithubRepoPushAction(options: {
156
157
  dismissStaleReviews?: boolean | undefined;
157
158
  requiredStatusCheckContexts?: string[] | undefined;
158
159
  bypassPullRequestAllowances?: {
160
+ users?: string[] | undefined;
159
161
  apps?: string[] | undefined;
160
162
  teams?: string[] | undefined;
161
- users?: string[] | undefined;
162
163
  } | undefined;
163
164
  requiredApprovingReviewCount?: number | undefined;
164
165
  restrictions?: {
165
- teams: string[];
166
166
  users: string[];
167
+ teams: string[];
167
168
  apps?: string[] | undefined;
168
169
  } | undefined;
169
170
  requireBranchesToBeUpToDate?: boolean | undefined;
@@ -337,14 +338,14 @@ declare function createPublishGithubAction(options: {
337
338
  homepage?: string | undefined;
338
339
  access?: string | undefined;
339
340
  bypassPullRequestAllowances?: {
341
+ users?: string[] | undefined;
340
342
  apps?: string[] | undefined;
341
343
  teams?: string[] | undefined;
342
- users?: string[] | undefined;
343
344
  } | undefined;
344
345
  requiredApprovingReviewCount?: number | undefined;
345
346
  restrictions?: {
346
- teams: string[];
347
347
  users: string[];
348
+ teams: string[];
348
349
  apps?: string[] | undefined;
349
350
  } | undefined;
350
351
  requireCodeOwnerReviews?: boolean | undefined;
@@ -447,13 +448,13 @@ declare function createGithubBranchProtectionAction(options: {
447
448
  requireCodeOwnerReviews?: boolean | undefined;
448
449
  dismissStaleReviews?: boolean | undefined;
449
450
  bypassPullRequestAllowances?: {
451
+ users?: string[] | undefined;
450
452
  apps?: string[] | undefined;
451
453
  teams?: string[] | undefined;
452
- users?: string[] | undefined;
453
454
  } | undefined;
454
455
  restrictions?: {
455
- teams: string[];
456
456
  users: string[];
457
+ teams: string[];
457
458
  apps?: string[] | undefined;
458
459
  } | undefined;
459
460
  requiredStatusCheckContexts?: string[] | undefined;
@@ -474,6 +475,34 @@ declare function createGithubBranchProtectionAction(options: {
474
475
  */
475
476
  declare const githubModule: _backstage_backend_plugin_api.BackendFeature;
476
477
 
478
+ /**
479
+ * Options used to override plugin-retry defaults
480
+ * @public
481
+ */
482
+ type RetryOptions = {
483
+ retries?: number;
484
+ retryAfter?: number;
485
+ };
486
+ /**
487
+ * Helper for generating an authenticated Octokit client with (or without)
488
+ * retry capabilities.
489
+ *
490
+ * If retries are enabled (default), the client will retry failed requests up
491
+ * to the specified number of retries and delay.
492
+ * To disable retries, set either `retries` or `retryAfter` to 0 in the options.
493
+ * @public
494
+ *
495
+ * @param octokitOptions - The options for configuring the Octokit client.
496
+ * Generally provided by the `getOctokitOptions` helper.
497
+ * @param logger - LoggerService instance for logging retry attempts and
498
+ * failures.
499
+ * @param retryOptions - Optional retry configuration options, including the
500
+ * number of retries and the delay between retries.
501
+ *
502
+ * @returns An authenticated Octokit client instance based on the provided
503
+ * options.
504
+ */
505
+ declare function getOctokitClient(octokitOptions: OctokitOptions, logger: LoggerService, retryOptions?: RetryOptions): Octokit;
477
506
  /**
478
507
  * Helper for generating octokit configuration options.
479
508
  * If no token is provided, it will attempt to get a token from the credentials provider.
@@ -500,5 +529,5 @@ declare function getOctokitOptions(options: {
500
529
  repoUrl: string;
501
530
  }): Promise<OctokitOptions>;
502
531
 
503
- export { createGithubActionsDispatchAction, createGithubAutolinksAction, createGithubBranchProtectionAction, createGithubDeployKeyAction, createGithubEnvironmentAction, createGithubIssuesCreateAction, createGithubIssuesLabelAction, createGithubPagesEnableAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishGithubAction, createPublishGithubPullRequestAction, githubModule as default, getOctokitOptions };
504
- export type { CreateGithubPullRequestActionOptions };
532
+ export { createGithubActionsDispatchAction, createGithubAutolinksAction, createGithubBranchProtectionAction, createGithubDeployKeyAction, createGithubEnvironmentAction, createGithubIssuesCreateAction, createGithubIssuesLabelAction, createGithubPagesEnableAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishGithubAction, createPublishGithubPullRequestAction, githubModule as default, getOctokitClient, getOctokitOptions };
533
+ export type { CreateGithubPullRequestActionOptions, RetryOptions };
package/dist/util.cjs.js CHANGED
@@ -3,8 +3,44 @@
3
3
  var errors = require('@backstage/errors');
4
4
  var integration = require('@backstage/integration');
5
5
  var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
6
+ var octokit = require('octokit');
7
+ var pluginRetry = require('@octokit/plugin-retry');
6
8
 
7
9
  const DEFAULT_TIMEOUT_MS = 6e4;
10
+ const DEFAULT_RETRY_ATTEMPTS = 3;
11
+ const DEFAULT_RETRY_DELAY_MS = 1e3;
12
+ function isRetryEnabled(retryOptions) {
13
+ if (retryOptions === void 0) {
14
+ return true;
15
+ }
16
+ if (retryOptions.retries !== void 0 && retryOptions.retries <= 0) {
17
+ return false;
18
+ }
19
+ if (retryOptions.retryAfter !== void 0 && retryOptions.retryAfter <= 0) {
20
+ return false;
21
+ }
22
+ return true;
23
+ }
24
+ function getOctokitClient(octokitOptions, logger, retryOptions) {
25
+ if (!isRetryEnabled(retryOptions)) {
26
+ return new octokit.Octokit({
27
+ ...octokitOptions,
28
+ log: logger
29
+ });
30
+ }
31
+ const OctokitClient = octokit.Octokit.plugin(pluginRetry.retry);
32
+ const retries = retryOptions?.retries ? retryOptions?.retries : DEFAULT_RETRY_ATTEMPTS;
33
+ const retryAfter = retryOptions?.retryAfter ? retryOptions?.retryAfter : DEFAULT_RETRY_DELAY_MS;
34
+ return new OctokitClient({
35
+ ...octokitOptions,
36
+ request: {
37
+ ...octokitOptions.request,
38
+ retries,
39
+ retryAfter
40
+ },
41
+ log: logger
42
+ });
43
+ }
8
44
  async function getOctokitOptions(options) {
9
45
  const { integrations, credentialsProvider, token, repoUrl } = options;
10
46
  const { host, owner, repo } = repoUrl ? pluginScaffolderNode.parseRepoUrl(repoUrl, integrations) : options;
@@ -47,5 +83,7 @@ async function getOctokitOptions(options) {
47
83
  };
48
84
  }
49
85
 
86
+ exports.getOctokitClient = getOctokitClient;
50
87
  exports.getOctokitOptions = getOctokitOptions;
88
+ exports.isRetryEnabled = isRetryEnabled;
51
89
  //# sourceMappingURL=util.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.cjs.js","sources":["../src/util.ts"],"sourcesContent":["/*\n * Copyright 2025 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 DefaultGithubCredentialsProvider,\n GithubCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport { parseRepoUrl } from '@backstage/plugin-scaffolder-node';\nimport { OctokitOptions } from '@octokit/core/dist-types/types';\n\nconst DEFAULT_TIMEOUT_MS = 60_000;\n\n/**\n * Helper for generating octokit configuration options.\n * If no token is provided, it will attempt to get a token from the credentials provider.\n * @public\n */\nexport async function getOctokitOptions(options: {\n integrations: ScmIntegrationRegistry;\n credentialsProvider?: GithubCredentialsProvider;\n token?: string;\n host: string;\n owner?: string;\n repo?: string;\n}): Promise<OctokitOptions>;\n\n/**\n * Helper for generating octokit configuration options for given repoUrl.\n * If no token is provided, it will attempt to get a token from the credentials provider.\n * @public\n * @deprecated Use options `host`, `owner` and `repo` instead of `repoUrl`.\n */\nexport async function getOctokitOptions(options: {\n integrations: ScmIntegrationRegistry;\n credentialsProvider?: GithubCredentialsProvider;\n token?: string;\n repoUrl: string;\n}): Promise<OctokitOptions>;\n\nexport async function getOctokitOptions(options: {\n integrations: ScmIntegrationRegistry;\n credentialsProvider?: GithubCredentialsProvider;\n token?: string;\n host?: string;\n owner?: string;\n repo?: string;\n repoUrl?: string;\n}): Promise<OctokitOptions> {\n const { integrations, credentialsProvider, token, repoUrl } = options;\n const { host, owner, repo } = repoUrl\n ? parseRepoUrl(repoUrl, integrations)\n : options;\n\n const requestOptions = {\n // set timeout to 60 seconds\n timeout: DEFAULT_TIMEOUT_MS,\n };\n\n const integrationConfig = integrations.github.byHost(host!)?.config;\n\n if (!integrationConfig) {\n throw new InputError(`No integration for host ${host}`);\n }\n\n // short circuit the `githubCredentialsProvider` if there is a token provided by the caller already\n if (token) {\n return {\n auth: token,\n baseUrl: integrationConfig.apiBaseUrl,\n previews: ['nebula-preview'],\n request: requestOptions,\n };\n }\n\n if (!owner || !repo) {\n throw new InputError(\n `No owner and/or repo provided, which is required if a token is not provided`,\n );\n }\n\n const githubCredentialsProvider =\n credentialsProvider ??\n DefaultGithubCredentialsProvider.fromIntegrations(integrations);\n\n const { token: credentialProviderToken } =\n await githubCredentialsProvider.getCredentials({\n url: `https://${host}/${encodeURIComponent(owner)}/${encodeURIComponent(\n repo,\n )}`,\n });\n\n if (!credentialProviderToken) {\n throw new InputError(\n `No token available for host: ${host}, with owner ${owner}, and repo ${repo}. Make sure GitHub auth is configured correctly. See https://backstage.io/docs/auth/github/provider for more details.`,\n );\n }\n\n return {\n auth: credentialProviderToken,\n baseUrl: integrationConfig.apiBaseUrl,\n previews: ['nebula-preview'],\n };\n}\n"],"names":["parseRepoUrl","InputError","DefaultGithubCredentialsProvider"],"mappings":";;;;;;AAyBA,MAAM,kBAAA,GAAqB,GAAA;AA6B3B,eAAsB,kBAAkB,OAAA,EAQZ;AAC1B,EAAA,MAAM,EAAE,YAAA,EAAc,mBAAA,EAAqB,KAAA,EAAO,SAAQ,GAAI,OAAA;AAC9D,EAAA,MAAM,EAAE,MAAM,KAAA,EAAO,IAAA,KAAS,OAAA,GAC1BA,iCAAA,CAAa,OAAA,EAAS,YAAY,CAAA,GAClC,OAAA;AAEJ,EAAA,MAAM,cAAA,GAAiB;AAAA;AAAA,IAErB,OAAA,EAAS;AAAA,GACX;AAEA,EAAA,MAAM,iBAAA,GAAoB,YAAA,CAAa,MAAA,CAAO,MAAA,CAAO,IAAK,CAAA,EAAG,MAAA;AAE7D,EAAA,IAAI,CAAC,iBAAA,EAAmB;AACtB,IAAA,MAAM,IAAIC,iBAAA,CAAW,CAAA,wBAAA,EAA2B,IAAI,CAAA,CAAE,CAAA;AAAA,EACxD;AAGA,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,KAAA;AAAA,MACN,SAAS,iBAAA,CAAkB,UAAA;AAAA,MAC3B,QAAA,EAAU,CAAC,gBAAgB,CAAA;AAAA,MAC3B,OAAA,EAAS;AAAA,KACX;AAAA,EACF;AAEA,EAAA,IAAI,CAAC,KAAA,IAAS,CAAC,IAAA,EAAM;AACnB,IAAA,MAAM,IAAIA,iBAAA;AAAA,MACR,CAAA,2EAAA;AAAA,KACF;AAAA,EACF;AAEA,EAAA,MAAM,yBAAA,GACJ,mBAAA,IACAC,4CAAA,CAAiC,gBAAA,CAAiB,YAAY,CAAA;AAEhE,EAAA,MAAM,EAAE,KAAA,EAAO,uBAAA,EAAwB,GACrC,MAAM,0BAA0B,cAAA,CAAe;AAAA,IAC7C,KAAK,CAAA,QAAA,EAAW,IAAI,IAAI,kBAAA,CAAmB,KAAK,CAAC,CAAA,CAAA,EAAI,kBAAA;AAAA,MACnD;AAAA,KACD,CAAA;AAAA,GACF,CAAA;AAEH,EAAA,IAAI,CAAC,uBAAA,EAAyB;AAC5B,IAAA,MAAM,IAAID,iBAAA;AAAA,MACR,CAAA,6BAAA,EAAgC,IAAI,CAAA,aAAA,EAAgB,KAAK,cAAc,IAAI,CAAA,qHAAA;AAAA,KAC7E;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,uBAAA;AAAA,IACN,SAAS,iBAAA,CAAkB,UAAA;AAAA,IAC3B,QAAA,EAAU,CAAC,gBAAgB;AAAA,GAC7B;AACF;;;;"}
1
+ {"version":3,"file":"util.cjs.js","sources":["../src/util.ts"],"sourcesContent":["/*\n * Copyright 2025 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 DefaultGithubCredentialsProvider,\n GithubCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport { parseRepoUrl } from '@backstage/plugin-scaffolder-node';\nimport { OctokitOptions } from '@octokit/core/dist-types/types';\nimport { Octokit } from 'octokit';\nimport { retry } from '@octokit/plugin-retry';\nimport { LoggerService } from '@backstage/backend-plugin-api';\n\nconst DEFAULT_TIMEOUT_MS = 60_000;\n\n// By default, octokit/plugin-retry will retry 3 times with a 1 second delay\n// between retries.\nconst DEFAULT_RETRY_ATTEMPTS = 3;\nconst DEFAULT_RETRY_DELAY_MS = 1_000;\n\n/**\n * Options used to override plugin-retry defaults\n * @public\n */\nexport type RetryOptions = {\n // The number of retry attempts for failed requests\n retries?: number;\n // The delay in milliseconds between retry attempts\n retryAfter?: number;\n};\n\n/**\n * Helper function to determine if retries are enabled based on the provided\n * options.\n *\n * @param retryOptions - Optional retry configuration options, including the number\n * of retries and the delay between retries.\n *\n * @returns False if retries/retryAfter are explicitly set to 0 or less.\n * Returns true otherwise.\n */\nexport function isRetryEnabled(retryOptions?: RetryOptions): boolean {\n if (retryOptions === undefined) {\n return true;\n }\n\n if (retryOptions.retries !== undefined && retryOptions.retries <= 0) {\n return false;\n }\n\n if (retryOptions.retryAfter !== undefined && retryOptions.retryAfter <= 0) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Helper for generating an authenticated Octokit client with (or without)\n * retry capabilities.\n *\n * If retries are enabled (default), the client will retry failed requests up\n * to the specified number of retries and delay.\n * To disable retries, set either `retries` or `retryAfter` to 0 in the options.\n * @public\n *\n * @param octokitOptions - The options for configuring the Octokit client.\n * Generally provided by the `getOctokitOptions` helper.\n * @param logger - LoggerService instance for logging retry attempts and\n * failures.\n * @param retryOptions - Optional retry configuration options, including the\n * number of retries and the delay between retries.\n *\n * @returns An authenticated Octokit client instance based on the provided\n * options.\n */\nexport function getOctokitClient(\n octokitOptions: OctokitOptions,\n logger: LoggerService,\n retryOptions?: RetryOptions,\n): Octokit {\n // Default behavior is to enable retries, but allow callers to disable by\n // explicitly setting retries or retryAfter to 0\n if (!isRetryEnabled(retryOptions)) {\n return new Octokit({\n ...octokitOptions,\n log: logger,\n });\n }\n\n // Update the octokit options to include retry configuration with logging\n const OctokitClient = Octokit.plugin(retry);\n\n // From the octokit/plugin-retry documentation, specifying these values will\n // always retry regardless of the response code\n const retries = retryOptions?.retries\n ? retryOptions?.retries\n : DEFAULT_RETRY_ATTEMPTS;\n const retryAfter = retryOptions?.retryAfter\n ? retryOptions?.retryAfter\n : DEFAULT_RETRY_DELAY_MS;\n\n return new OctokitClient({\n ...octokitOptions,\n request: {\n ...octokitOptions.request,\n retries,\n retryAfter,\n },\n log: logger,\n });\n}\n\n/**\n * Helper for generating octokit configuration options.\n * If no token is provided, it will attempt to get a token from the credentials provider.\n * @public\n */\nexport async function getOctokitOptions(options: {\n integrations: ScmIntegrationRegistry;\n credentialsProvider?: GithubCredentialsProvider;\n token?: string;\n host: string;\n owner?: string;\n repo?: string;\n}): Promise<OctokitOptions>;\n\n/**\n * Helper for generating octokit configuration options for given repoUrl.\n * If no token is provided, it will attempt to get a token from the credentials provider.\n * @public\n * @deprecated Use options `host`, `owner` and `repo` instead of `repoUrl`.\n */\nexport async function getOctokitOptions(options: {\n integrations: ScmIntegrationRegistry;\n credentialsProvider?: GithubCredentialsProvider;\n token?: string;\n repoUrl: string;\n}): Promise<OctokitOptions>;\n\nexport async function getOctokitOptions(options: {\n integrations: ScmIntegrationRegistry;\n credentialsProvider?: GithubCredentialsProvider;\n token?: string;\n host?: string;\n owner?: string;\n repo?: string;\n repoUrl?: string;\n}): Promise<OctokitOptions> {\n const { integrations, credentialsProvider, token, repoUrl } = options;\n const { host, owner, repo } = repoUrl\n ? parseRepoUrl(repoUrl, integrations)\n : options;\n\n const requestOptions = {\n // set timeout to 60 seconds\n timeout: DEFAULT_TIMEOUT_MS,\n };\n\n const integrationConfig = integrations.github.byHost(host!)?.config;\n\n if (!integrationConfig) {\n throw new InputError(`No integration for host ${host}`);\n }\n\n // short circuit the `githubCredentialsProvider` if there is a token provided by the caller already\n if (token) {\n return {\n auth: token,\n baseUrl: integrationConfig.apiBaseUrl,\n previews: ['nebula-preview'],\n request: requestOptions,\n };\n }\n\n if (!owner || !repo) {\n throw new InputError(\n `No owner and/or repo provided, which is required if a token is not provided`,\n );\n }\n\n const githubCredentialsProvider =\n credentialsProvider ??\n DefaultGithubCredentialsProvider.fromIntegrations(integrations);\n\n const { token: credentialProviderToken } =\n await githubCredentialsProvider.getCredentials({\n url: `https://${host}/${encodeURIComponent(owner)}/${encodeURIComponent(\n repo,\n )}`,\n });\n\n if (!credentialProviderToken) {\n throw new InputError(\n `No token available for host: ${host}, with owner ${owner}, and repo ${repo}. Make sure GitHub auth is configured correctly. See https://backstage.io/docs/auth/github/provider for more details.`,\n );\n }\n\n return {\n auth: credentialProviderToken,\n baseUrl: integrationConfig.apiBaseUrl,\n previews: ['nebula-preview'],\n };\n}\n"],"names":["Octokit","retry","parseRepoUrl","InputError","DefaultGithubCredentialsProvider"],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend-module-github",
3
- "version": "0.9.9-next.0",
3
+ "version": "0.9.10-next.0",
4
4
  "description": "The github module for @backstage/plugin-scaffolder-backend",
5
5
  "backstage": {
6
6
  "role": "backend-plugin-module",
@@ -50,15 +50,16 @@
50
50
  "test": "backstage-cli package test"
51
51
  },
52
52
  "dependencies": {
53
- "@backstage/backend-plugin-api": "1.9.1-next.0",
54
- "@backstage/catalog-model": "1.8.1-next.0",
55
- "@backstage/config": "1.3.8-next.0",
56
- "@backstage/errors": "1.3.1-next.0",
57
- "@backstage/integration": "2.0.2-next.0",
58
- "@backstage/plugin-catalog-node": "2.2.1-next.0",
59
- "@backstage/plugin-scaffolder-node": "0.13.3-next.0",
53
+ "@backstage/backend-plugin-api": "1.9.2-next.0",
54
+ "@backstage/catalog-model": "1.9.0",
55
+ "@backstage/config": "1.3.8",
56
+ "@backstage/errors": "1.3.1",
57
+ "@backstage/integration": "2.0.3-next.0",
58
+ "@backstage/plugin-catalog-node": "2.2.2-next.0",
59
+ "@backstage/plugin-scaffolder-node": "0.13.4-next.0",
60
60
  "@backstage/types": "1.2.2",
61
61
  "@octokit/core": "^5.0.0",
62
+ "@octokit/plugin-retry": "^6.0.0",
62
63
  "@octokit/webhooks": "^10.9.2",
63
64
  "libsodium-wrappers": "^0.8.0",
64
65
  "octokit": "^3.0.0",
@@ -67,9 +68,9 @@
67
68
  "zod": "^3.25.76 || ^4.0.0"
68
69
  },
69
70
  "devDependencies": {
70
- "@backstage/backend-test-utils": "1.11.3-next.0",
71
- "@backstage/cli": "0.36.2-next.0",
72
- "@backstage/plugin-scaffolder-node-test-utils": "0.3.11-next.0",
71
+ "@backstage/backend-test-utils": "1.11.4-next.0",
72
+ "@backstage/cli": "0.36.3-next.0",
73
+ "@backstage/plugin-scaffolder-node-test-utils": "0.3.12-next.0",
73
74
  "@types/libsodium-wrappers": "^0.8.0",
74
75
  "fs-extra": "^11.2.0",
75
76
  "jsonschema": "^1.2.6"