Skip to content

Commit

Permalink
Merge pull request #2096 from IDEMSInternational/fix/gdrive-watch-mul…
Browse files Browse the repository at this point in the history
…tiple

fix: gdrive watch mulitple
  • Loading branch information
chrismclarke authored Oct 9, 2023
2 parents 01591f1 + 5886df0 commit 8ea0fc8
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions packages/workflows/src/sync.workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,27 @@ const workflows: IDeploymentWorkflows = {
{
name: "sync_watch",
function: async ({ tasks, config, workflow }) => {
tasks.gdrive.liveReload({
folderId: config.google_drive.sheets_folder_id,
onUpdate: async (filepath) => {
// only respond to xlsx file changes
if (filepath.endsWith(".xlsx")) {
// TODO - add better methods to process single sheet instead of all
await tasks.workflow.runWorkflow({
name: "sync_sheets",
parent: workflow,
args: ["--skip-download"],
});
tasks.appData.copyDeploymentDataToApp();
}
},
});
let { sheets_folder_ids, sheets_folder_id } = config.google_drive;
if (!sheets_folder_ids) {
sheets_folder_ids = [sheets_folder_id];
}
for (const folderId of sheets_folder_ids) {
tasks.gdrive.liveReload({
folderId,
onUpdate: async (filepath) => {
// only respond to xlsx file changes
if (filepath.endsWith(".xlsx")) {
// TODO - add better methods to process single sheet instead of all
await tasks.workflow.runWorkflow({
name: "sync_sheets",
parent: workflow,
args: ["--skip-download"],
});
tasks.appData.copyDeploymentDataToApp();
}
},
});
}
},
},
],
Expand Down

0 comments on commit 8ea0fc8

Please sign in to comment.