From 63bd035710ebbff03f432d2e985549b22e284b7f Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 11 Feb 2020 13:38:54 +0100 Subject: [PATCH] Check no changes (#62) --- lib/main.js | 5 +++++ src/main.ts | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/lib/main.js b/lib/main.js index fa40820..245abf4 100644 --- a/lib/main.js +++ b/lib/main.js @@ -72,6 +72,11 @@ function run() { core.info(`✍️ Writing ${fqdn} domain name to ${path.join(tmpdir, 'CNAME')}`); fs.writeFileSync(path.join(tmpdir, 'CNAME'), fqdn.trim()); } + const dirty = child_process.execSync(`git status --short`, { encoding: 'utf8' }).trim().length > 0; + if (keep_history && remote_branch_exists && !dirty) { + core.info('⚠️ There are no changes to commit, stopping.'); + return; + } core.info(`🔨 Configuring git committer to be ${committer_name} <${committer_email}>`); yield exec.exec('git', ['config', 'user.name', committer_name]); yield exec.exec('git', ['config', 'user.email', committer_email]); diff --git a/src/main.ts b/src/main.ts index 52ca7fb..61a8801 100644 --- a/src/main.ts +++ b/src/main.ts @@ -59,6 +59,12 @@ async function run() { fs.writeFileSync(path.join(tmpdir, 'CNAME'), fqdn.trim()); } + const dirty = child_process.execSync(`git status --short`, {encoding: 'utf8'}).trim().length > 0; + if (keep_history && remote_branch_exists && !dirty) { + core.info('⚠️ There are no changes to commit, stopping.'); + return; + } + core.info(`🔨 Configuring git committer to be ${committer_name} <${committer_email}>`); await exec.exec('git', ['config', 'user.name', committer_name]); await exec.exec('git', ['config', 'user.email', committer_email]);