From f6132f37d6a7cf8033e87476d4749a1061b2c407 Mon Sep 17 00:00:00 2001 From: Martin Stefcek Date: Wed, 9 Feb 2022 22:01:04 +0700 Subject: [PATCH] fix: daily test --- applications/daily_tests/cron_jobs.js | 4 ++++ applications/daily_tests/helpers.js | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/applications/daily_tests/cron_jobs.js b/applications/daily_tests/cron_jobs.js index d3041c6250d..a353bdc2179 100644 --- a/applications/daily_tests/cron_jobs.js +++ b/applications/daily_tests/cron_jobs.js @@ -123,6 +123,10 @@ ${logLines.join("\n")} async function main() { console.log("👩‍💻 Updating repo..."); + await git.reset(__dirname).catch((err) => { + console.error("🚨 Failed to do git reset --hard"); + console.error(err); + }); await git.pull(__dirname).catch((err) => { console.error("🚨 Failed to update git repo"); console.error(err); diff --git a/applications/daily_tests/helpers.js b/applications/daily_tests/helpers.js index 1dd97a016f8..e01c6608fde 100644 --- a/applications/daily_tests/helpers.js +++ b/applications/daily_tests/helpers.js @@ -154,10 +154,10 @@ async function monitorProcessOutput({ } const git = { - pull(cwd = null) { + command(params, cwd = null) { cwd = cwd || process.cwd(); return new Promise((resolve, reject) => { - let ps = spawn("git", ["pull", "--rebase"], { cwd }); + let ps = spawn("git", params, { cwd }); ps.stdout.on("data", (buf) => { console.log(buf.toString()); }); @@ -173,6 +173,8 @@ const git = { }); }); }, + reset: (cwd = null) => git.command(["reset", "--hard"], cwd), + pull: (cwd = null) => git.command(["pull", "--rebase"], cwd), }; module.exports = {