@@ -27558,22 +27558,15 @@ var __webpack_exports__ = {};
2755827558const core = __nccwpck_require__(7484);
2755927559const { execSync } = __nccwpck_require__(5317);
2756027560const fs = __nccwpck_require__(9896);
27561+ const path = __nccwpck_require__(6928);
2756127562
27563+ // Get inputs
2756227564const action = core.getInput('action');
2756327565const googleApiKeyJsonRaw = core.getInput('google_api_key_json');
2756427566const spreadsheetId = core.getInput('spreadsheet_id');
2756527567const localizationRoot = core.getInput('localization_root');
2756627568
27567- // Parse the JSON
27568- let googleApiKeyJson;
27569- try {
27570- googleApiKeyJson = JSON.parse(googleApiKeyJsonRaw);
27571- } catch (error) {
27572- core.setFailed('Invalid Google API Key JSON.');
27573- process.exit(1);
27574- }
27575-
27576- if (!googleApiKeyJson) {
27569+ if (!googleApiKeyJsonRaw) {
2757727570 core.setFailed('Google API Key JSON is required.');
2757827571 process.exit(1);
2757927572}
@@ -27588,6 +27581,15 @@ if (!localizationRoot) {
2758827581 process.exit(1);
2758927582}
2759027583
27584+ // Parse the Google API Key JSON
27585+ let googleApiKeyJson;
27586+ try {
27587+ googleApiKeyJson = JSON.parse(googleApiKeyJsonRaw);
27588+ } catch (error) {
27589+ core.setFailed('Invalid Google API Key JSON.');
27590+ process.exit(1);
27591+ }
27592+
2759127593// Debug logging
2759227594core.info(`Action: ${action}`);
2759327595core.info(`Google API Key JSON: ${googleApiKeyJson ? 'Provided' : 'Not Provided'}`);
@@ -27602,16 +27604,18 @@ process.env.SPREADSHEET_ID = spreadsheetId;
2760227604process.env.LOCALIZATION_ROOT = localizationRoot;
2760327605
2760427606try {
27607+ let scriptPath;
2760527608 if (action === 'push') {
27606- const scriptPath = __nccwpck_require__.ab + "push-json-to-google-sheets.js";
27607- execSync(`node ${scriptPath}`, { stdio: 'inherit' });
27609+ scriptPath = __nccwpck_require__.ab + "push-json-to-google-sheets.js";
2760827610 } else if (action === 'pull') {
27609- const scriptPath = __nccwpck_require__.ab + "pull-google-sheets-to-json.js";
27610- execSync(`node ${scriptPath}`, { stdio: 'inherit' });
27611+ scriptPath = __nccwpck_require__.ab + "pull-google-sheets-to-json.js";
2761127612 } else {
2761227613 core.setFailed(`Unknown action: ${action}`);
2761327614 process.exit(1);
2761427615 }
27616+
27617+ // Execute the corresponding script
27618+ execSync(`node ${scriptPath}`, { stdio: 'inherit' });
2761527619} catch (error) {
2761627620 core.setFailed(`Action failed with error: ${error.message}`);
2761727621 process.exit(1);
0 commit comments