@firestartr/cli 1.32.0 → 1.34.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/build/_loadurl.js +50 -0
- package/build/index.js +182 -31
- package/build/provisioner/dist-cdktf/index.js +7 -3
- package/build/provisioner/dist-cdktf/index.js.map +1 -1
- package/build/provisioner/dist-cdktf/src/entities/firestartrgithubrepository/helpers/AdditionalBranchesHelper.d.ts +4 -0
- package/build/provisioner/dist-cdktf/src/entities/firestartrgithubrepository/helpers/AdditionalBranchesHelper.js +35 -0
- package/build/provisioner/dist-cdktf/src/handlers/index.d.ts +1 -1
- package/build/provisioner/dist-cdktf/tsconfig.cdktf.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Construct } from 'constructs';
|
|
2
|
+
import { Repository } from '@cdktf/provider-github/lib/repository';
|
|
3
|
+
import { FirestartrGithubRepository } from '../FirestartrGithubRepository';
|
|
4
|
+
export declare function provisionAdditionalBranches(scope: Construct, fsGithubRepository: FirestartrGithubRepository, repo: Repository, org: string): Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.provisionAdditionalBranches = void 0;
|
|
7
|
+
const github_1 = __importDefault(require("github"));
|
|
8
|
+
// Main function to provision additional branches
|
|
9
|
+
async function provisionAdditionalBranches(scope, fsGithubRepository, repo, org) {
|
|
10
|
+
// Obtain the additional branches from the repository configuration
|
|
11
|
+
const branches = fsGithubRepository.spec.repo.additionalBranches;
|
|
12
|
+
// Obtain the existing branches from the repository
|
|
13
|
+
const existingBranches = await github_1.default.branches.listBranches(repo.name, org);
|
|
14
|
+
const existingBranchNames = existingBranches.map((branch) => branch.name);
|
|
15
|
+
// Filter out the branches that already exist
|
|
16
|
+
const branchesToCreate = branches.filter((branch) => !existingBranchNames.includes(branch.name));
|
|
17
|
+
// Provision the new branches
|
|
18
|
+
for (const branch of branchesToCreate) {
|
|
19
|
+
if (branch.orphan) {
|
|
20
|
+
await github_1.default.branches.createOrphanBranch(repo.name, branch.name, org);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
await provisionRegularBranch(repo.name, branch.name, repo.defaultBranch, org);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.provisionAdditionalBranches = provisionAdditionalBranches;
|
|
28
|
+
// function to provision a regular branch
|
|
29
|
+
async function provisionRegularBranch(repo, branchName, sourceBranch, org) {
|
|
30
|
+
// Obtaining the sha of the source branch
|
|
31
|
+
const sourceBranchData = await github_1.default.branches.getBranch(repo, sourceBranch, org);
|
|
32
|
+
const sha = sourceBranchData.commit.sha;
|
|
33
|
+
// Create the new branch
|
|
34
|
+
await github_1.default.branches.createBranch(repo, branchName, sha, org);
|
|
35
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function prepareFeatures(components: any, storeRef: any): Promise<void>;
|
|
2
|
-
export declare function getActionByStatus(status: any):
|
|
2
|
+
export declare function getActionByStatus(status: any): import("catalog_common/dist/src/types/catalog").ArtifactStatuses.unknownStatus | "deploy" | "destroy";
|
|
3
3
|
export declare function getNextStatus(status: any): import("catalog_common/dist/src/types/catalog").ArtifactStatuses.deletedStatus | import("catalog_common/dist/src/types/catalog").ArtifactStatuses.errorStatus | import("catalog_common/dist/src/types/catalog").ArtifactStatuses.creatingStatus | import("catalog_common/dist/src/types/catalog").ArtifactStatuses.renamingStatus | import("catalog_common/dist/src/types/catalog").ArtifactStatuses.provisionedStatus | import("catalog_common/dist/src/types/catalog").ArtifactStatuses.provisioningStatus | import("catalog_common/dist/src/types/catalog").ArtifactStatuses.unknownStatus;
|