From 95f24899b260e24653964707badb3b789dce83c2 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Sat, 4 Nov 2023 14:23:03 +1100 Subject: [PATCH] fix: update codecovcli_args --- codecov_ats.sh | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/codecov_ats.sh b/codecov_ats.sh index 639d6a7..72c86c9 100755 --- a/codecov_ats.sh +++ b/codecov_ats.sh @@ -14,10 +14,7 @@ say() { } -# Install Codecov CLI -pip install codecov-cli - -# Set up Codecov token +# Set up token variables if [[ -n $INPUTS_CODECOV_TOKEN ]]; then CODECOV_TOKEN=$INPUTS_CODECOV_TOKEN fi @@ -37,16 +34,28 @@ if [[ -z $CODECOV_STATIC_TOKEN ]]; then else say "$b==>$x Static token of length ${#CODECOV_STATIC_TOKEN} detected" fi -base_commit_candidates=($(git log --format=%H | sed -n "1,10p")) # Get last 10 commits -codecovcli create-commit -t ${CODECOV_TOKEN} || say "${r}Codecov: Failed to properly create commit$x" -codecovcli create-report -t ${CODECOV_TOKEN} || say "${r}Codecov: Failed to properly create report$x" -codecovcli static-analysis --token=${CODECOV_STATIC_TOKEN} || say "${r}Codecov: Failed to properly execute static analysis" +#Set up codecovcli arguments +codecovcli_args="" +[[ $INPUTS_VERBOSE == true ]] && codecovcli_args+="-v" +[[ -n $INPUTS_ENTERPRISE_URL ]] && codecovcli_args+="-u ${INPUTS_ENTERPRISE_URL}" + +#Set up codecovcli command arguments +command_args="" +[[ -n $INPUTS_PARENT_SHA ]] && $command_args+="" +# Install Codecov CLI +pip install codecov-cli + +codecovcli ${codecovcli_args} create-commit -t ${CODECOV_TOKEN} || say "${r}Codecov: Failed to properly create commit$x" +codecovcli ${codecovcli_args} create-report -t ${CODECOV_TOKEN} || say "${r}Codecov: Failed to properly create report$x" +codecovcli ${codecovcli_args} static-analysis --token=${CODECOV_STATIC_TOKEN} || say "${r}Codecov: Failed to properly execute static analysis" + +base_commit_candidates=($(git log --format=%H | sed -n "1,10p")) # Get last 10 commits for base_commit in ${base_commit_candidates[@]} do say "$y==>$x Attempting label analysis with $b$base_commit$x" - response=$(codecovcli label-analysis --token=${CODECOV_STATIC_TOKEN} --base-sha=$base_commit --dry-run --dry-run-format="json" || true) + response=$(codecovcli ${codecovcli_args} label-analysis --token=${CODECOV_STATIC_TOKEN} --base-sha=$base_commit --dry-run --dry-run-format="json" || true) if [[ -n $response ]]; then break else