@@ -27558,22 +27558,15 @@ var __webpack_exports__ = {};
27558
27558
const core = __nccwpck_require__(7484);
27559
27559
const { execSync } = __nccwpck_require__(5317);
27560
27560
const fs = __nccwpck_require__(9896);
27561
+ const path = __nccwpck_require__(6928);
27561
27562
27563
+ // Get inputs
27562
27564
const action = core.getInput('action');
27563
27565
const googleApiKeyJsonRaw = core.getInput('google_api_key_json');
27564
27566
const spreadsheetId = core.getInput('spreadsheet_id');
27565
27567
const localizationRoot = core.getInput('localization_root');
27566
27568
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) {
27577
27570
core.setFailed('Google API Key JSON is required.');
27578
27571
process.exit(1);
27579
27572
}
@@ -27588,6 +27581,15 @@ if (!localizationRoot) {
27588
27581
process.exit(1);
27589
27582
}
27590
27583
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
+
27591
27593
// Debug logging
27592
27594
core.info(`Action: ${action}`);
27593
27595
core.info(`Google API Key JSON: ${googleApiKeyJson ? 'Provided' : 'Not Provided'}`);
@@ -27602,16 +27604,18 @@ process.env.SPREADSHEET_ID = spreadsheetId;
27602
27604
process.env.LOCALIZATION_ROOT = localizationRoot;
27603
27605
27604
27606
try {
27607
+ let scriptPath;
27605
27608
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";
27608
27610
} 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";
27611
27612
} else {
27612
27613
core.setFailed(`Unknown action: ${action}`);
27613
27614
process.exit(1);
27614
27615
}
27616
+
27617
+ // Execute the corresponding script
27618
+ execSync(`node ${scriptPath}`, { stdio: 'inherit' });
27615
27619
} catch (error) {
27616
27620
core.setFailed(`Action failed with error: ${error.message}`);
27617
27621
process.exit(1);
0 commit comments