From 03018818a53d0974bcca9110ba5461cef8fdf6a9 Mon Sep 17 00:00:00 2001 From: Conrad Date: Mon, 16 Mar 2020 15:30:17 +0100 Subject: [PATCH] Added dry mode --- action.yml | 6 +++++- entrypoint.sh | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index f76da71..41e867c 100644 --- a/action.yml +++ b/action.yml @@ -20,8 +20,12 @@ inputs: required: false default: '--write **/*.js' branch: - description: Branch which the changes are merged to + description: Target branch for the changes required: true + dry: + description: Running the script in dry mode just shows whether there are files that should be prettified or not + required: false + default: False runs: using: 'docker' diff --git a/entrypoint.sh b/entrypoint.sh index 4aa8b06..01a0ddb 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -40,10 +40,11 @@ echo "Installing prettier..." npm install --silent --global prettier echo "Prettifing files..." -prettier $INPUT_PRETTIER_OPTIONS || echo "Problem while prettifying your files with options $INPUT_PRETTIER_OPTIONS" +echo "Files:" +prettier $INPUT_PRETTIER_OPTIONS || echo "Problem while prettifying your files with options $INPUT_PRETTIER_OPTIONS." # To keep runtime good, just continue if something was changed -if _git_changed; +if [! $INPUT_DRY] && [_git_changed]; then # Calling method to configure the git environemnt _git_setup