@firestartr/cli 2.3.0 → 2.4.0-snapshot-1

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/build/index.js CHANGED
@@ -284669,6 +284669,23 @@ async function getRepoInfo(owner, name) {
284669
284669
  const res = await octokit.repos.get({ owner: owner, repo: name });
284670
284670
  return res['data'];
284671
284671
  }
284672
+ async function repoExists(owner, name) {
284673
+ github_src_logger.info(`Checking if repo exists: ${owner}/${name}`);
284674
+ try {
284675
+ await getRepoInfo(owner, name);
284676
+ return true;
284677
+ }
284678
+ catch (error) {
284679
+ const status = typeof error === 'object' && error !== null && 'status' in error
284680
+ ? error.status
284681
+ : undefined;
284682
+ if (status === 404) {
284683
+ return false;
284684
+ }
284685
+ github_src_logger.error(`Failed to determine if repo exists: ${owner}/${name}`, error);
284686
+ throw error;
284687
+ }
284688
+ }
284672
284689
  async function getPages(owner, name) {
284673
284690
  github_src_logger.info(`Getting pages for ${owner}/${name}`);
284674
284691
  const octokit = await getOctokitForOrg(owner);
@@ -284796,6 +284813,20 @@ async function addCommitStatus(state, sha, repo, owner = 'prefapp', target_url =
284796
284813
  context,
284797
284814
  });
284798
284815
  }
284816
+ async function getRepoIssuesLabels(owner, repo) {
284817
+ github_src_logger.info(`Getting issues labels for ${owner}/${repo}`);
284818
+ const octokit = await getOctokitForOrg(owner);
284819
+ const res = await octokit.issues.listLabelsForRepo({
284820
+ owner: owner,
284821
+ repo: repo,
284822
+ });
284823
+ const metadataLabels = res.data.map((label) => ({
284824
+ name: label.name,
284825
+ description: label.description || '',
284826
+ color: label.color,
284827
+ }));
284828
+ return metadataLabels;
284829
+ }
284799
284830
  /* harmony default export */ const repository = ({
284800
284831
  listReleases,
284801
284832
  getReleaseByTag,
@@ -284804,6 +284835,7 @@ async function addCommitStatus(state, sha, repo, owner = 'prefapp', target_url =
284804
284835
  uploadFile,
284805
284836
  deleteFile,
284806
284837
  getRepoInfo,
284838
+ repoExists,
284807
284839
  getPages,
284808
284840
  getBranchProtection,
284809
284841
  getTeams,
@@ -284811,6 +284843,7 @@ async function addCommitStatus(state, sha, repo, owner = 'prefapp', target_url =
284811
284843
  getOIDCRepo,
284812
284844
  addStatusCheck,
284813
284845
  addCommitStatus,
284846
+ getRepoIssuesLabels,
284814
284847
  });
284815
284848
 
284816
284849
  ;// CONCATENATED MODULE: ../github/src/team.ts
@@ -287911,6 +287944,44 @@ MetadataInitializer.applicableKinds = [
287911
287944
  ];
287912
287945
 
287913
287946
 
287947
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/initializers/component_labels.ts
287948
+
287949
+ class ComponentLabelsInitializer extends InitializerPatches {
287950
+ constructor() {
287951
+ super(...arguments);
287952
+ this.applicableProviders = ['github'];
287953
+ }
287954
+ async __validate() {
287955
+ return true;
287956
+ }
287957
+ async __patches(_claim, _previousCR) {
287958
+ return [
287959
+ {
287960
+ validate(cr) {
287961
+ if (cr.spec.repo.labels) {
287962
+ const visited = new Set();
287963
+ for (const label of cr.spec.repo.labels) {
287964
+ if (visited.has(label.name)) {
287965
+ throw `There is already a label called ${label.name} in the ComponentClaim ${cr.metadata.name}. Labels must be unique`;
287966
+ }
287967
+ visited.add(label.name);
287968
+ }
287969
+ }
287970
+ return true;
287971
+ },
287972
+ apply(cr) {
287973
+ return cr;
287974
+ },
287975
+ identify() {
287976
+ return 'initializers/ComponentLabels';
287977
+ },
287978
+ },
287979
+ ];
287980
+ }
287981
+ }
287982
+ ComponentLabelsInitializer.applicableKinds = ['ComponentClaim'];
287983
+
287984
+
287914
287985
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/initializers/index.ts
287915
287986
 
287916
287987
 
@@ -287922,6 +287993,7 @@ MetadataInitializer.applicableKinds = [
287922
287993
 
287923
287994
 
287924
287995
 
287996
+
287925
287997
  const INITIALIZERS = [
287926
287998
  UUIDInitializer,
287927
287999
  InitializerClaimRef,
@@ -287929,6 +288001,7 @@ const INITIALIZERS = [
287929
288001
  PolicyInitializer,
287930
288002
  SyncerInitializer,
287931
288003
  MetadataInitializer,
288004
+ ComponentLabelsInitializer,
287932
288005
  ];
287933
288006
  const INITIALIZERS_BY_FILE_NAME = {
287934
288007
  [TechnologyInitializer.FILE_NAME()]: TechnologyInitializer,
@@ -289338,6 +289411,12 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
289338
289411
  pattern: '^[a-z0-9][a-z0-9-]*$',
289339
289412
  },
289340
289413
  },
289414
+ labels: {
289415
+ type: 'array',
289416
+ items: {
289417
+ $ref: 'firestartr.dev://github/GithubComponentClaimLabel',
289418
+ },
289419
+ },
289341
289420
  overrides: {
289342
289421
  type: 'object',
289343
289422
  properties: {},
@@ -289546,6 +289625,40 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
289546
289625
  },
289547
289626
  });
289548
289627
 
289628
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/github/component.labels.schema.ts
289629
+
289630
+ /* harmony default export */ const component_labels_schema = ({
289631
+ $schema: SCHEMA,
289632
+ $id: 'GithubComponentClaimLabels',
289633
+ definitions: {
289634
+ GithubComponentClaimLabel: {
289635
+ $id: 'firestartr.dev://github/GithubComponentClaimLabel',
289636
+ type: 'object',
289637
+ required: ['name', 'color'],
289638
+ properties: {
289639
+ name: {
289640
+ type: 'string',
289641
+ minLength: 1,
289642
+ maxLength: 50,
289643
+ pattern: '^(?!\\s+$)[^"\\\\]+$',
289644
+ description: 'Label name (1-50 chars, no " or \\ characters)',
289645
+ },
289646
+ color: {
289647
+ type: 'string',
289648
+ pattern: '^[0-9a-fA-F]{6}$',
289649
+ description: 'Color in hexadecimal without # (6 chars)',
289650
+ },
289651
+ description: {
289652
+ type: 'string',
289653
+ maxLength: 100,
289654
+ description: 'Optional label description (max 100 chars)',
289655
+ },
289656
+ },
289657
+ additionalProperties: false,
289658
+ },
289659
+ },
289660
+ });
289661
+
289549
289662
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/github/index.ts
289550
289663
 
289551
289664
 
@@ -289553,6 +289666,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
289553
289666
 
289554
289667
 
289555
289668
 
289669
+
289556
289670
  const GithubSchemas = [
289557
289671
  github_group_schema,
289558
289672
  github_user_schema,
@@ -289560,6 +289674,7 @@ const GithubSchemas = [
289560
289674
  github_component_schema,
289561
289675
  github_orgwebhook_schema,
289562
289676
  component_secrets_vars_schema,
289677
+ component_labels_schema,
289563
289678
  ];
289564
289679
 
289565
289680
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/tfworkspaces/terraform.schema.ts
@@ -293574,6 +293689,7 @@ function toJson_FirestartrGithubRepositorySpecRepo(obj) {
293574
293689
  'hasWiki': obj.hasWiki,
293575
293690
  'pages': obj.pages,
293576
293691
  'topics': obj.topics?.map(y => y),
293692
+ 'labels': obj.labels?.map(y => toJson_FirestartrGithubRepositorySpecRepoLabels(y)),
293577
293693
  'visibility': obj.visibility,
293578
293694
  'defaultBranch': obj.defaultBranch,
293579
293695
  'additionalBranches': obj.additionalBranches?.map(y => toJson_FirestartrGithubRepositorySpecRepoAdditionalBranches(y)),
@@ -293720,6 +293836,22 @@ function toJson_FirestartrGithubRepositorySpecFirestartrTechnology(obj) {
293720
293836
  // filter undefined values
293721
293837
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
293722
293838
  }
293839
+ /**
293840
+ * Converts an object of type 'FirestartrGithubRepositorySpecRepoLabels' to JSON representation.
293841
+ */
293842
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
293843
+ function toJson_FirestartrGithubRepositorySpecRepoLabels(obj) {
293844
+ if (obj === undefined) {
293845
+ return undefined;
293846
+ }
293847
+ const result = {
293848
+ 'name': obj.name,
293849
+ 'color': obj.color,
293850
+ 'description': obj.description,
293851
+ };
293852
+ // filter undefined values
293853
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
293854
+ }
293723
293855
  /* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
293724
293856
  /**
293725
293857
  * @schema FirestartrGithubRepositorySpecRepoVisibility
@@ -295715,6 +295847,7 @@ class GithubRepositoryChart extends BaseGithubChart {
295715
295847
  defaultBranch: claim.providers.github?.branchStrategy?.defaultBranch,
295716
295848
  codeowners: createCodeOwnersData(claim),
295717
295849
  additionalBranches: claim.providers.github.additionalBranches || [],
295850
+ labels: claim.providers.github.labels || [],
295718
295851
  topics: claim.providers.github.topics || [],
295719
295852
  },
295720
295853
  actions,
@@ -298027,6 +298160,17 @@ const TYPE_MAP = {
298027
298160
  Team: 'group',
298028
298161
  Organization: 'org',
298029
298162
  };
298163
+ const DEFAULT_LABELS = [
298164
+ 'bug',
298165
+ 'documentation',
298166
+ 'duplicate',
298167
+ 'enhancement',
298168
+ 'good first issue',
298169
+ 'help wanted',
298170
+ 'invalid',
298171
+ 'question',
298172
+ 'wontfix',
298173
+ ];
298030
298174
  class RepoGithubDecanter extends GithubDecanter {
298031
298175
  constructor(data, org, githubTeams = {}) {
298032
298176
  super(data, org);
@@ -298241,6 +298385,19 @@ class RepoGithubDecanter extends GithubDecanter {
298241
298385
  }));
298242
298386
  }
298243
298387
  }
298388
+ async __decantRepoLabels() {
298389
+ let labels = this.data.labels || [];
298390
+ labels = labels.filter((label) => {
298391
+ return !DEFAULT_LABELS.includes(label.name);
298392
+ });
298393
+ if (labels && labels.length > 0) {
298394
+ this.__patchClaim({
298395
+ op: 'add',
298396
+ value: labels,
298397
+ path: '/providers/github/labels',
298398
+ });
298399
+ }
298400
+ }
298244
298401
  async __gatherRepoTeamsAndMembers() {
298245
298402
  this.data['teamsAndMembers'] = {};
298246
298403
  const directMembers = (await github.repo.getCollaborators(this.data.repoDetails.owner.login, this.data.repoDetails.name, 'direct')).map((member) => {
@@ -298307,6 +298464,16 @@ class RepoGithubDecanter extends GithubDecanter {
298307
298464
  }
298308
298465
  importer_src_logger.info(`No CODEOWNERS file found for ${this.data.repoDetails.name}, skipping.`);
298309
298466
  }
298467
+ async __gatherRepoLabels() {
298468
+ try {
298469
+ const labels = await github.repo.getRepoIssuesLabels(this.org, this.data.repoDetails.name);
298470
+ this.data['labels'] = labels;
298471
+ }
298472
+ catch (e) {
298473
+ importer_src_logger.error(`Error fetching labels for ${this.data.repoDetails.name}: ${e.message}`);
298474
+ throw new Error(`Error fetching labels for ${this.data.repoDetails.name}: ${e.message}`);
298475
+ }
298476
+ }
298310
298477
  async __adaptInitializerBranchStrategies(_claim) {
298311
298478
  const bpData = this.data.branchStrategy.data;
298312
298479
  if (this.data.branchStrategy.kind === 'custom') {
@@ -305642,7 +305809,7 @@ const MODULES = {
305642
305809
  },
305643
305810
  FirestartrGithubRepository: {
305644
305811
  module: 'git::https://github.com/prefapp/tfm.git//modules/github-repo',
305645
- ref: 'fix/remove-topics-from-creation-to-avoid-crashes',
305812
+ ref: 'github-repo-v0.2.0',
305646
305813
  },
305647
305814
  FirestartrGithubRepositoryFeature: {
305648
305815
  module: 'git::https://github.com/prefapp/tfm.git//modules/github-files-set',
@@ -306236,6 +306403,76 @@ function provisionPermissions(fsGithubRepository) {
306236
306403
  }
306237
306404
  }
306238
306405
 
306406
+ ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghrepo/helpers/labels.ts
306407
+ // if we are to provision labels using tofu and the label already
306408
+ // exists, we should not attempt to re-create it. This function checks
306409
+ // if the label exists and if so, imports it into Terraform state. This is needed because
306410
+ // tofu does not have an "upsert" operation for labels, so we need to check
306411
+ // if the label exists before trying to create it, otherwise we will get an error.
306412
+
306413
+
306414
+
306415
+ async function provisionLabels(fsGithubRepository, repoAlreadyExists) {
306416
+ try {
306417
+ const cr = fsGithubRepository.cr;
306418
+ const labels = cr.spec.repo.labels;
306419
+ if (!labels || labels.length === 0) {
306420
+ return;
306421
+ }
306422
+ if (repoAlreadyExists) {
306423
+ await importLabelsIfNeeded(fsGithubRepository);
306424
+ }
306425
+ for (const label of labels) {
306426
+ gh_provisioner_src_logger.debug(`[gh-provisioner] ${fsGithubRepository.k8sId} provisioning label ${label.name}`);
306427
+ fsGithubRepository.patchData({
306428
+ op: PatchOperations.add,
306429
+ path: '/config/labels/-',
306430
+ value: {
306431
+ name: label.name,
306432
+ color: label.color,
306433
+ description: label.description,
306434
+ },
306435
+ });
306436
+ }
306437
+ }
306438
+ catch (err) {
306439
+ gh_provisioner_src_logger.error(`[gh-provisioner] ${fsGithubRepository.k8sId} error on provisionLabels: ${err}`);
306440
+ throw new Error(`Error on provisionLabels: ${err}`);
306441
+ }
306442
+ }
306443
+ async function importLabelsIfNeeded(fsGithubRepository) {
306444
+ const cr = fsGithubRepository.cr;
306445
+ try {
306446
+ const labels = cr.spec.repo.labels;
306447
+ gh_provisioner_src_logger.info(`[gh-provisioner] ${fsGithubRepository.k8sId} checking if labels need to be imported`);
306448
+ const repoIssuesList = await fsGithubRepository.runWithGithubProvider(async () => {
306449
+ return await github.repo.getRepoIssuesLabels(cr.spec.org, cr.name);
306450
+ });
306451
+ // labels that already exist in GitHub must be imported into Terraform state
306452
+ // so that Terraform manages them rather than trying to create them (which would fail)
306453
+ for (const label of labels) {
306454
+ if (!checkIfLabelExists(label.name, repoIssuesList)) {
306455
+ continue;
306456
+ }
306457
+ fsGithubRepository.patchImportData({
306458
+ op: PatchOperations.add,
306459
+ path: '/imports/-',
306460
+ value: {
306461
+ to: 'github_issue_label.this["' + label.name + '"]',
306462
+ id: `${cr.name}:${label.name}`,
306463
+ },
306464
+ });
306465
+ }
306466
+ }
306467
+ catch (err) {
306468
+ gh_provisioner_src_logger.error(`[gh-provisioner] ${fsGithubRepository.k8sId} error on importLabelsIfNeeded: ${err}`);
306469
+ throw new Error(`Error on importLabelsIfNeeded: ${err}`);
306470
+ }
306471
+ }
306472
+ function checkIfLabelExists(labelName, repoIssuesList) {
306473
+ return repoIssuesList.some((label) => label.name === labelName);
306474
+ }
306475
+
306239
306476
  ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghrepo/helpers/index.ts
306240
306477
 
306241
306478
 
@@ -306243,6 +306480,7 @@ function provisionPermissions(fsGithubRepository) {
306243
306480
 
306244
306481
 
306245
306482
 
306483
+
306246
306484
  ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghrepo/post/additional_branches.ts
306247
306485
 
306248
306486
 
@@ -306307,6 +306545,7 @@ async function provisionRegularBranch(repo, branchName, sourceBranch, org) {
306307
306545
 
306308
306546
 
306309
306547
 
306548
+
306310
306549
  class EntityGHRepo extends base_Entity {
306311
306550
  constructor(artifact) {
306312
306551
  super(artifact, {
@@ -306315,18 +306554,24 @@ class EntityGHRepo extends base_Entity {
306315
306554
  variables: [],
306316
306555
  teams: [],
306317
306556
  collaborators: [],
306557
+ labels: [],
306318
306558
  },
306319
306559
  });
306320
306560
  }
306321
306561
  async loadResources(tfOp) {
306562
+ let repoAlreadyExists = false;
306322
306563
  try {
306323
306564
  this.synthMessage('Loading resources to Synth...');
306565
+ repoAlreadyExists = (await this.runWithGithubProvider(async () => {
306566
+ return await github.repo.repoExists(this.cr.spec.org, this.cr.name);
306567
+ }));
306324
306568
  await this.provisionRepository();
306325
306569
  await provisionDefaultBranch(this);
306326
306570
  await provisionCodeowners(this);
306327
306571
  await provisionVariables(this);
306328
306572
  await provisionOIDCSubjectClaim(this);
306329
306573
  await provisionPermissions(this);
306574
+ await provisionLabels(this, repoAlreadyExists);
306330
306575
  this.synthMessage('Synth finished');
306331
306576
  this.synthEnd(JSON.stringify(this.document, null, 2));
306332
306577
  }
@@ -308525,7 +308770,7 @@ const crs_analyzerSubcommand = {
308525
308770
  };
308526
308771
 
308527
308772
  ;// CONCATENATED MODULE: ./package.json
308528
- const package_namespaceObject = {"i8":"2.3.0"};
308773
+ const package_namespaceObject = JSON.parse('{"i8":"2.4.0-snapshot-1"}');
308529
308774
  ;// CONCATENATED MODULE: ../../package.json
308530
308775
  const package_namespaceObject_1 = {"i8":"2.3.0"};
308531
308776
  ;// CONCATENATED MODULE: ./src/subcommands/index.ts
@@ -1018,6 +1018,12 @@ export interface FirestartrGithubRepositorySpecRepo {
1018
1018
  * @schema FirestartrGithubRepositorySpecRepo#topics
1019
1019
  */
1020
1020
  readonly topics?: string[];
1021
+ /**
1022
+ * Array of labels to create in GitHub
1023
+ *
1024
+ * @schema FirestartrGithubRepositorySpecRepo#labels
1025
+ */
1026
+ readonly labels?: FirestartrGithubRepositorySpecRepoLabels[];
1021
1027
  /**
1022
1028
  * @schema FirestartrGithubRepositorySpecRepo#visibility
1023
1029
  */
@@ -1204,6 +1210,33 @@ export interface FirestartrGithubRepositorySpecFirestartrTechnology {
1204
1210
  * Converts an object of type 'FirestartrGithubRepositorySpecFirestartrTechnology' to JSON representation.
1205
1211
  */
1206
1212
  export declare function toJson_FirestartrGithubRepositorySpecFirestartrTechnology(obj: FirestartrGithubRepositorySpecFirestartrTechnology | undefined): Record<string, any> | undefined;
1213
+ /**
1214
+ * @schema FirestartrGithubRepositorySpecRepoLabels
1215
+ */
1216
+ export interface FirestartrGithubRepositorySpecRepoLabels {
1217
+ /**
1218
+ * Label name (1-50 characters, not only whitespace)
1219
+ *
1220
+ * @schema FirestartrGithubRepositorySpecRepoLabels#name
1221
+ */
1222
+ readonly name: string;
1223
+ /**
1224
+ * Hexadecimal color without # (6 characters)
1225
+ *
1226
+ * @schema FirestartrGithubRepositorySpecRepoLabels#color
1227
+ */
1228
+ readonly color: string;
1229
+ /**
1230
+ * Optional label description (max 100 characters)
1231
+ *
1232
+ * @schema FirestartrGithubRepositorySpecRepoLabels#description
1233
+ */
1234
+ readonly description?: string;
1235
+ }
1236
+ /**
1237
+ * Converts an object of type 'FirestartrGithubRepositorySpecRepoLabels' to JSON representation.
1238
+ */
1239
+ export declare function toJson_FirestartrGithubRepositorySpecRepoLabels(obj: FirestartrGithubRepositorySpecRepoLabels | undefined): Record<string, any> | undefined;
1207
1240
  /**
1208
1241
  * @schema FirestartrGithubRepositorySpecRepoVisibility
1209
1242
  */
@@ -784,6 +784,12 @@ declare const schemas: {
784
784
  pattern: string;
785
785
  };
786
786
  };
787
+ labels: {
788
+ type: string;
789
+ items: {
790
+ $ref: string;
791
+ };
792
+ };
787
793
  overrides: {
788
794
  type: string;
789
795
  properties: {};
@@ -941,6 +947,36 @@ declare const schemas: {
941
947
  additionalProperties: boolean;
942
948
  };
943
949
  };
950
+ } | {
951
+ $schema: string;
952
+ $id: string;
953
+ definitions: {
954
+ GithubComponentClaimLabel: {
955
+ $id: string;
956
+ type: string;
957
+ required: string[];
958
+ properties: {
959
+ name: {
960
+ type: string;
961
+ minLength: number;
962
+ maxLength: number;
963
+ pattern: string;
964
+ description: string;
965
+ };
966
+ color: {
967
+ type: string;
968
+ pattern: string;
969
+ description: string;
970
+ };
971
+ description: {
972
+ type: string;
973
+ maxLength: number;
974
+ description: string;
975
+ };
976
+ };
977
+ additionalProperties: boolean;
978
+ };
979
+ };
944
980
  })[] | {
945
981
  $id: string;
946
982
  definitions: {
@@ -0,0 +1,32 @@
1
+ declare const _default: {
2
+ $schema: string;
3
+ $id: string;
4
+ definitions: {
5
+ GithubComponentClaimLabel: {
6
+ $id: string;
7
+ type: string;
8
+ required: string[];
9
+ properties: {
10
+ name: {
11
+ type: string;
12
+ minLength: number;
13
+ maxLength: number;
14
+ pattern: string;
15
+ description: string;
16
+ };
17
+ color: {
18
+ type: string;
19
+ pattern: string;
20
+ description: string;
21
+ };
22
+ description: {
23
+ type: string;
24
+ maxLength: number;
25
+ description: string;
26
+ };
27
+ };
28
+ additionalProperties: boolean;
29
+ };
30
+ };
31
+ };
32
+ export default _default;
@@ -188,6 +188,12 @@ declare const _default: {
188
188
  pattern: string;
189
189
  };
190
190
  };
191
+ labels: {
192
+ type: string;
193
+ items: {
194
+ $ref: string;
195
+ };
196
+ };
191
197
  overrides: {
192
198
  type: string;
193
199
  properties: {};
@@ -315,6 +315,12 @@ export declare const GithubSchemas: ({
315
315
  pattern: string;
316
316
  };
317
317
  };
318
+ labels: {
319
+ type: string;
320
+ items: {
321
+ $ref: string;
322
+ };
323
+ };
318
324
  overrides: {
319
325
  type: string;
320
326
  properties: {};
@@ -472,4 +478,34 @@ export declare const GithubSchemas: ({
472
478
  additionalProperties: boolean;
473
479
  };
474
480
  };
481
+ } | {
482
+ $schema: string;
483
+ $id: string;
484
+ definitions: {
485
+ GithubComponentClaimLabel: {
486
+ $id: string;
487
+ type: string;
488
+ required: string[];
489
+ properties: {
490
+ name: {
491
+ type: string;
492
+ minLength: number;
493
+ maxLength: number;
494
+ pattern: string;
495
+ description: string;
496
+ };
497
+ color: {
498
+ type: string;
499
+ pattern: string;
500
+ description: string;
501
+ };
502
+ description: {
503
+ type: string;
504
+ maxLength: number;
505
+ description: string;
506
+ };
507
+ };
508
+ additionalProperties: boolean;
509
+ };
510
+ };
475
511
  })[];
@@ -29,6 +29,7 @@ export interface IGithubRepositoryClaim extends IComponentClaim {
29
29
  orphan: boolean;
30
30
  }[];
31
31
  topics?: string[];
32
+ labels?: IComponentClaimLabel[];
32
33
  };
33
34
  };
34
35
  }
@@ -53,5 +54,10 @@ interface IRepositoryPage {
53
54
  path: string;
54
55
  };
55
56
  }
57
+ interface IComponentClaimLabel {
58
+ name: string;
59
+ color: string;
60
+ description?: string;
61
+ }
56
62
  export type IComponentClaimOwnerType = 'user' | 'group';
57
63
  export {};
@@ -0,0 +1,11 @@
1
+ import { InitializerPatches } from './base';
2
+ export declare class ComponentLabelsInitializer extends InitializerPatches {
3
+ applicableProviders: string[];
4
+ static applicableKinds: string[];
5
+ __validate(): Promise<boolean>;
6
+ __patches(_claim: any, _previousCR: any): Promise<{
7
+ validate(cr: any): boolean;
8
+ apply(cr: any): any;
9
+ identify(): string;
10
+ }[]>;
11
+ }
@@ -3,3 +3,4 @@ export { provisionCodeowners } from './codeowners';
3
3
  export { provisionVariables } from './variables';
4
4
  export { provisionOIDCSubjectClaim } from './actions_oidc';
5
5
  export { provisionPermissions } from './teams';
6
+ export { provisionLabels } from './labels';
@@ -0,0 +1,2 @@
1
+ import { EntityGHRepo } from '../';
2
+ export declare function provisionLabels(fsGithubRepository: EntityGHRepo, repoAlreadyExists: boolean): Promise<void>;
@@ -24,6 +24,7 @@ declare const _default: {
24
24
  uploadFile: typeof import("./src/repository").uploadFile;
25
25
  deleteFile: typeof import("./src/repository").deleteFile;
26
26
  getRepoInfo: typeof import("./src/repository").getRepoInfo;
27
+ repoExists: typeof import("./src/repository").repoExists;
27
28
  getPages: typeof import("./src/repository").getPages;
28
29
  getBranchProtection: typeof import("./src/repository").getBranchProtection;
29
30
  getTeams: typeof import("./src/repository").getTeams;
@@ -31,6 +32,7 @@ declare const _default: {
31
32
  getOIDCRepo: typeof import("./src/repository").getOIDCRepo;
32
33
  addStatusCheck: typeof import("./src/repository").addStatusCheck;
33
34
  addCommitStatus: typeof import("./src/repository").addCommitStatus;
35
+ getRepoIssuesLabels: typeof import("./src/repository").getRepoIssuesLabels;
34
36
  };
35
37
  team: {
36
38
  getTeamMembers: typeof import("./src/team").getTeamMembers;
@@ -800,6 +800,7 @@ export declare function getRepoInfo(owner: string, name: string): Promise<{
800
800
  [key: string]: unknown;
801
801
  };
802
802
  }>;
803
+ export declare function repoExists(owner: string, name: string): Promise<boolean>;
803
804
  export declare function getPages(owner: string, name: string): Promise<{
804
805
  url: string;
805
806
  status: "built" | "building" | "errored";
@@ -1321,6 +1322,11 @@ export declare function uploadFile(destinationPath: string, filePath: string, re
1321
1322
  export declare function deleteFile(path: string, repo: string, owner?: string, branch?: string, message?: string): Promise<void>;
1322
1323
  export declare function addStatusCheck(output: any, is_failure: boolean, head_sha: string, name: string, status: string, repo: string, owner?: string): Promise<void>;
1323
1324
  export declare function addCommitStatus(state: commitStatusState, sha: string, repo: string, owner?: string, target_url?: string, description?: string, context?: string): Promise<void>;
1325
+ export declare function getRepoIssuesLabels(owner: string, repo: string): Promise<{
1326
+ name: string;
1327
+ description: string;
1328
+ color: string;
1329
+ }[]>;
1324
1330
  declare const _default: {
1325
1331
  listReleases: typeof listReleases;
1326
1332
  getReleaseByTag: typeof getReleaseByTag;
@@ -1329,6 +1335,7 @@ declare const _default: {
1329
1335
  uploadFile: typeof uploadFile;
1330
1336
  deleteFile: typeof deleteFile;
1331
1337
  getRepoInfo: typeof getRepoInfo;
1338
+ repoExists: typeof repoExists;
1332
1339
  getPages: typeof getPages;
1333
1340
  getBranchProtection: typeof getBranchProtection;
1334
1341
  getTeams: typeof getTeams;
@@ -1336,5 +1343,6 @@ declare const _default: {
1336
1343
  getOIDCRepo: typeof getOIDCRepo;
1337
1344
  addStatusCheck: typeof addStatusCheck;
1338
1345
  addCommitStatus: typeof addCommitStatus;
1346
+ getRepoIssuesLabels: typeof getRepoIssuesLabels;
1339
1347
  };
1340
1348
  export default _default;
@@ -10,11 +10,13 @@ export default class RepoGithubDecanter extends GithubDecanter {
10
10
  __decantOIDC(): void;
11
11
  __decantValidateCodeowners(): void;
12
12
  __decantRelations(): void;
13
+ __decantRepoLabels(): Promise<void>;
13
14
  __gatherRepoTeamsAndMembers(): Promise<void>;
14
15
  __gatherPages(): Promise<void>;
15
16
  __gatherOIDCSubjectClaim(): Promise<void>;
16
17
  __gatherBranchStrategy(): Promise<void>;
17
18
  __gatherCodeowners(): Promise<void>;
19
+ __gatherRepoLabels(): Promise<void>;
18
20
  __adaptInitializerBranchStrategies(_claim: any): Promise<BranchStrategiesInitializer>;
19
21
  __adaptInitializerBase(_claim: any): Promise<InitializerDefault>;
20
22
  __adaptOverriderRepo(_claim: any): Promise<GithubRepositoryOverrider>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "2.3.0",
3
+ "version": "2.4.0-snapshot-1",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",