Skip to content

Commit 727c41c

Browse files
committed
C
1 parent 6781ce1 commit 727c41c

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

dist/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754869,7 +754869,7 @@ const { fetchSheetData: pullMain } = __nccwpck_require__(19868);
754869754869

754870754870
// Function to list the contents of the root folder
754871754871
const listRootFolderContents = () => {
754872-
const rootFolder = process.cwd();
754872+
const rootFolder = __dirname;
754873754873
const files = fs.readdirSync(rootFolder);
754874754874
core.info(`Root folder contents: ${files.join(', ')}`);
754875754875
};
@@ -754899,6 +754899,7 @@ if (!localizationRoot) {
754899754899
let googleApiKeyJson;
754900754900
try {
754901754901
googleApiKeyJson = JSON.parse(googleApiKeyJsonRaw);
754902+
core.info('Parsed Google API Key JSON successfully.');
754902754903
} catch (error) {
754903754904
core.setFailed('Invalid Google API Key JSON.');
754904754905
process.exit(1);
@@ -754915,7 +754916,13 @@ listRootFolderContents();
754915754916

754916754917
// Write the Google API key to a file
754917754918
const googleApiKeyFilePath = path.join(__dirname, 'google-api-key.json');
754918-
fs.writeFileSync(googleApiKeyFilePath, JSON.stringify(googleApiKeyJson));
754919+
try {
754920+
fs.writeFileSync(googleApiKeyFilePath, JSON.stringify(googleApiKeyJson));
754921+
core.info(`Google API key file created at: ${googleApiKeyFilePath}`);
754922+
} catch (error) {
754923+
core.setFailed(`Failed to write Google API key file: ${error.message}`);
754924+
process.exit(1);
754925+
}
754919754926

754920754927
process.env.GOOGLE_APPLICATION_CREDENTIALS = googleApiKeyFilePath;
754921754928
process.env.SPREADSHEET_ID = spreadsheetId;
@@ -754924,6 +754931,7 @@ process.env.LOCALIZATION_ROOT = localizationRoot;
754924754931
const cleanUp = () => {
754925754932
if (fs.existsSync(googleApiKeyFilePath)) {
754926754933
fs.unlinkSync(googleApiKeyFilePath);
754934+
core.info(`Google API key file deleted: ${googleApiKeyFilePath}`);
754927754935
}
754928754936
};
754929754937

entrypoint.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { fetchSheetData: pullMain } = require('./scripts/pull-google-sheets-to-js
66

77
// Function to list the contents of the root folder
88
const listRootFolderContents = () => {
9-
const rootFolder = process.cwd();
9+
const rootFolder = __dirname;
1010
const files = fs.readdirSync(rootFolder);
1111
core.info(`Root folder contents: ${files.join(', ')}`);
1212
};
@@ -36,6 +36,7 @@ if (!localizationRoot) {
3636
let googleApiKeyJson;
3737
try {
3838
googleApiKeyJson = JSON.parse(googleApiKeyJsonRaw);
39+
core.info('Parsed Google API Key JSON successfully.');
3940
} catch (error) {
4041
core.setFailed('Invalid Google API Key JSON.');
4142
process.exit(1);
@@ -52,7 +53,13 @@ listRootFolderContents();
5253

5354
// Write the Google API key to a file
5455
const googleApiKeyFilePath = path.join(__dirname, 'google-api-key.json');
55-
fs.writeFileSync(googleApiKeyFilePath, JSON.stringify(googleApiKeyJson));
56+
try {
57+
fs.writeFileSync(googleApiKeyFilePath, JSON.stringify(googleApiKeyJson));
58+
core.info(`Google API key file created at: ${googleApiKeyFilePath}`);
59+
} catch (error) {
60+
core.setFailed(`Failed to write Google API key file: ${error.message}`);
61+
process.exit(1);
62+
}
5663

5764
process.env.GOOGLE_APPLICATION_CREDENTIALS = googleApiKeyFilePath;
5865
process.env.SPREADSHEET_ID = spreadsheetId;
@@ -61,6 +68,7 @@ process.env.LOCALIZATION_ROOT = localizationRoot;
6168
const cleanUp = () => {
6269
if (fs.existsSync(googleApiKeyFilePath)) {
6370
fs.unlinkSync(googleApiKeyFilePath);
71+
core.info(`Google API key file deleted: ${googleApiKeyFilePath}`);
6472
}
6573
};
6674

0 commit comments

Comments
 (0)