@firestartr/cli 1.45.0-snapshot-3 → 1.45.0-snapshot-4
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
@@ -269633,13 +269633,17 @@ function createAppAuth(options) {
|
|
269633
269633
|
|
269634
269634
|
|
269635
269635
|
|
269636
|
-
async function getInstallationID() {
|
269636
|
+
async function getInstallationID(org = 'default') {
|
269637
269637
|
const auth = createAppAuth({
|
269638
269638
|
appId: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppId),
|
269639
269639
|
privateKey: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppPemFile),
|
269640
269640
|
request: dist_bundle_request,
|
269641
269641
|
});
|
269642
|
-
|
269642
|
+
if ((await checkIfInstalledForOrg(org)) !== true) {
|
269643
|
+
// there is no installation for the org requested
|
269644
|
+
// we use the default org
|
269645
|
+
org = catalog_common.environment.getFromEnvironmentWithDefault(catalog_common.types.envVars.org);
|
269646
|
+
}
|
269643
269647
|
const response = await dist_bundle_request(`GET /orgs/${org}/installation`, {
|
269644
269648
|
org,
|
269645
269649
|
request: {
|
@@ -269648,7 +269652,7 @@ async function getInstallationID() {
|
|
269648
269652
|
});
|
269649
269653
|
return response.data.id;
|
269650
269654
|
}
|
269651
|
-
async function
|
269655
|
+
async function checkIfInstalledForOrg(org = 'default') {
|
269652
269656
|
const auth = createAppAuth({
|
269653
269657
|
appId: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppId),
|
269654
269658
|
privateKey: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppPemFile),
|
@@ -269659,10 +269663,8 @@ async function getOrgOfInstallation() {
|
|
269659
269663
|
hook: auth.hook,
|
269660
269664
|
},
|
269661
269665
|
});
|
269662
|
-
|
269663
|
-
|
269664
|
-
}
|
269665
|
-
return installations[0].account.login;
|
269666
|
+
const installation = installations.find((installation) => installation.account.login === org);
|
269667
|
+
return installation !== undefined;
|
269666
269668
|
}
|
269667
269669
|
|
269668
269670
|
;// CONCATENATED MODULE: ../github/src/auth.ts
|
@@ -269693,7 +269695,7 @@ async function getGithubAppToken(org = 'default', genGithubAppToken = generateGi
|
|
269693
269695
|
const token = await genGithubAppToken({
|
269694
269696
|
appId: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppId),
|
269695
269697
|
privateKey: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppPemFile),
|
269696
|
-
installationOrgId: await getInstallationID(),
|
269698
|
+
installationOrgId: await getInstallationID(org),
|
269697
269699
|
});
|
269698
269700
|
return token;
|
269699
269701
|
}
|
@@ -269703,7 +269705,7 @@ async function getOctokitForOrg(org = 'default', paginated = false, genGithubApp
|
|
269703
269705
|
const auth = await genGithubAppToken({
|
269704
269706
|
appId: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppId),
|
269705
269707
|
privateKey: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppPemFile),
|
269706
|
-
installationOrgId: await getInstallationID(),
|
269708
|
+
installationOrgId: await getInstallationID(org),
|
269707
269709
|
});
|
269708
269710
|
const options = { auth: auth };
|
269709
269711
|
if (paginated) {
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare function getInstallationID(): Promise<any>;
|
2
|
-
export declare function
|
1
|
+
export declare function getInstallationID(org?: string): Promise<any>;
|
2
|
+
export declare function checkIfInstalledForOrg(org?: string): Promise<boolean>;
|