@@ -10908,6 +10908,40 @@ catch (error) {
1090810908}
1090910909
1091010910
10911+ /***/ }),
10912+
10913+ /***/ 8946:
10914+ /***/ ((__unused_webpack_module, exports) => {
10915+
10916+ "use strict";
10917+
10918+ Object.defineProperty(exports, "__esModule", ({ value: true }));
10919+ exports.scopeQuery = void 0;
10920+ const GRAPHQL_ENDPOINT = 'https://api.v2.bit.cloud/graphql';
10921+ const scopeQuery = (id, token) => {
10922+ const query = `
10923+ query GET_SCOPE($scopeId: String!) {
10924+ getScope(id: $scopeId) {
10925+ id
10926+ }
10927+ }
10928+ `;
10929+ const variables = { scopeId: id };
10930+ return fetch(GRAPHQL_ENDPOINT, {
10931+ method: 'POST',
10932+ headers: {
10933+ 'Content-Type': 'application/json',
10934+ Authorization: `Bearer ${token}`,
10935+ },
10936+ body: JSON.stringify({
10937+ query,
10938+ variables,
10939+ }),
10940+ }).then(response => response.json());
10941+ };
10942+ exports.scopeQuery = scopeQuery;
10943+
10944+
1091110945/***/ }),
1091210946
1091310947/***/ 595:
@@ -10951,6 +10985,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
1095110985const exec_1 = __nccwpck_require__(1514);
1095210986const github_1 = __nccwpck_require__(5438);
1095310987const core = __importStar(__nccwpck_require__(2186));
10988+ const graphql_1 = __nccwpck_require__(8946);
1095410989const createSnapMessageText = (githubToken, repo, owner, prNumber) => __awaiter(void 0, void 0, void 0, function* () {
1095510990 const octokit = (0, github_1.getOctokit)(githubToken);
1095610991 let messageText = "CI";
@@ -11099,10 +11134,23 @@ const createVersionLabels = (githubToken, repo, owner, prNumber, status, version
1109911134 }
1110011135});
1110111136function run(githubToken, repo, owner, prNumber, laneName, versionLabel, versionLabelsColors, wsDir, args) {
11137+ var _a, _b;
1110211138 return __awaiter(this, void 0, void 0, function* () {
1110311139 const org = process.env.ORG;
1110411140 const scope = process.env.SCOPE;
11141+ const token = process.env.BIT_CONFIG_USER_TOKEN || "";
1110511142 let statusRaw = "";
11143+ const scopeErrorMessage = `Scope: ${org}.${scope} does not exist or you don't have access to it`;
11144+ try {
11145+ const jsonData = yield (0, graphql_1.scopeQuery)(`${org}.${scope}`, token);
11146+ if (!((_b = (_a = jsonData === null || jsonData === void 0 ? void 0 : jsonData.data) === null || _a === void 0 ? void 0 : _a.getScope) === null || _b === void 0 ? void 0 : _b.id)) {
11147+ throw new Error(scopeErrorMessage);
11148+ }
11149+ }
11150+ catch (error) {
11151+ console.log(error);
11152+ throw new Error(scopeErrorMessage);
11153+ }
1110611154 yield (0, exec_1.exec)("bit", ["status", "--json"], {
1110711155 cwd: wsDir,
1110811156 listeners: {
0 commit comments