From d4b99cb84eb73e92aa963c4df5ddbdf140f1cf14 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Thu, 22 Aug 2024 22:41:11 +0100 Subject: [PATCH] Add debug mode parameter. --- action.yml | 29 ++++++++++++++++------------- entrypoint.sh | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/action.yml b/action.yml index 95178d2..686b619 100644 --- a/action.yml +++ b/action.yml @@ -1,36 +1,39 @@ # action.yml -name: 'Semantic Version Generator' -description: 'Automagic semantic version generator' +name: "Semantic Version Generator" +description: "Automagic semantic version generator" author: Lukasz Raczylo branding: icon: chevron-right color: gray-dark inputs: config_file: - description: 'Configuration file' + description: "Configuration file" required: false repository_url: - description: 'Repository URL' + description: "Repository URL" required: false - default: 'https://github.com/lukaszraczylo/simple-gql-client' + default: "https://github.com/lukaszraczylo/simple-gql-client" repository_local: - description: 'Use already cloned repository in current directory' + description: "Use already cloned repository in current directory" required: false github_token: - description: 'GitHub Personal Access Token OR password' + description: "GitHub Personal Access Token OR password" required: false github_username: - description: 'GitHub or other git hosting provider username' + description: "GitHub or other git hosting provider username" required: false strict: - description: 'Strict mode' + description: "Strict mode" required: false existing: - description: 'Respect existing tags' + description: "Respect existing tags" + required: false + debugmode: + description: "Debug mode" required: false outputs: semantic_version: - description: 'Calculated semantic version' + description: "Calculated semantic version" runs: - using: 'docker' - image: 'docker://ghcr.io/lukaszraczylo/semver-generator:latest' + using: "docker" + image: "docker://ghcr.io/lukaszraczylo/semver-generator:latest" diff --git a/entrypoint.sh b/entrypoint.sh index a92809d..d64e03f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,6 +5,7 @@ FLAGS="$SEMVER_RAW_FLAGS" if [[ -z "$INPUT_CONFIG_FILE" ]]; then echo "Set the configuration file path." + exit 1 else FLAGS="${FLAGS} -c $INPUT_CONFIG_FILE" fi @@ -34,6 +35,10 @@ if [[ ! -z "$INPUT_EXISTING" ]]; then FLAGS="${FLAGS} -e" fi +if [[ ! =z "$INPUT_DEBUGMODE"]]; then + FLAGS="${FLAGS} --debug" +fi + if [[ "${FLAGS}" == "" && "$*" == "" ]]; then exit 1 fi @@ -46,6 +51,19 @@ if [[ ! -z "$INPUT_GITHUB_USERNAME" ]]; then export GITHUB_USERNAME=$INPUT_GITHUB_USERNAME fi +if [[ ! -z "$INPUT_DEBUGMODE" ]]; then + echo "DEBUG MODE ENABLED" + echo "----" + ls -lA + echo "----" + pwd + echo "----" + echo "FLAGS: $FLAGS" + echo "----" + /go/src/app/semver-gen generate $FLAGS $* + echo "----" +fi + OUT_SEMVER_GEN=$(/go/src/app/semver-gen generate $FLAGS $*) [ $? -eq 0 ] || exit 1 CLEAN_SEMVER=$(echo $OUT_SEMVER_GEN | sed -e 's|SEMVER ||g')