Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redirect error messages to STDERR #31

Merged
merged 2 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions dist/codecov_ats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
echo -e "$1"
}

error() {
echo -e "${r}$*${e}" >&2

Check warning on line 17 in dist/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

dist/codecov_ats.sh#L17

Added line #L17 was not covered by tests
}

# Set up token variables
if [[ -n $INPUTS_CODECOV_TOKEN ]]; then
CODECOV_TOKEN=$INPUTS_CODECOV_TOKEN
fi
if [[ -z $CODECOV_TOKEN ]]; then
say "${r}Token not provided or could not be found in environment. Exiting${x}"
error "Token not provided or could not be found in environment. Exiting"

Check warning on line 25 in dist/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

dist/codecov_ats.sh#L25

Added line #L25 was not covered by tests
exit 1
else
say "$b==>$x Token of length ${#CODECOV_TOKEN} detected"
Expand All @@ -29,7 +32,7 @@
CODECOV_STATIC_TOKEN=$INPUTS_CODECOV_STATIC_TOKEN
fi
if [[ -z $CODECOV_STATIC_TOKEN ]]; then
say "${r}Static token not provided or could not be found in environment. Exiting${x}"
error "Static token not provided or could not be found in environment. Exiting"

Check warning on line 35 in dist/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

dist/codecov_ats.sh#L35

Added line #L35 was not covered by tests
exit 1
else
say "$b==>$x Static token of length ${#CODECOV_STATIC_TOKEN} detected"
Expand Down Expand Up @@ -73,22 +76,22 @@
if $(codecovcli ${codecovcli_args}create-commit ${create_commit_args}-t ${CODECOV_TOKEN}); then
say "${g}Codecov: Successfully created commit record$x"
else
say "${r}Codecov: Failed to properly create commit$x"
error "Codecov: Failed to properly create commit"

Check warning on line 79 in dist/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

dist/codecov_ats.sh#L79

Added line #L79 was not covered by tests
exit 1
fi

if $(codecovcli ${codecovcli_args}create-report ${create_report_args}-t ${CODECOV_TOKEN}); then
say "${g}Codecov: Successfully created report record$x"
else
say "${r}Codecov: Failed to properly create report$x"
error "Codecov: Failed to properly create report"

Check warning on line 86 in dist/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

dist/codecov_ats.sh#L86

Added line #L86 was not covered by tests
exit 1
fi

codecovcli ${codecovcli_args}static-analysis ${static_analysis_args}--token ${CODECOV_STATIC_TOKEN}
if [[ $? == 0 ]]; then
say "${g}Codecov: Successfully ran static analysis$x"
else
say "${r}Codecov: Failed to run static analysis$x"
error "Codecov: Failed to run static analysis"

Check warning on line 94 in dist/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

dist/codecov_ats.sh#L94

Added line #L94 was not covered by tests
exit 1
fi

Expand All @@ -110,7 +113,7 @@
done

if [[ -z $response && -n $INPUTS_OVERRIDE_BASE_COMMIT ]]; then
say "${r}Codecov: Failed to run label analysis. Please select a different base commit.$x"
error "Codecov: Failed to run label analysis. Please select a different base commit."

Check warning on line 116 in dist/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

dist/codecov_ats.sh#L116

Added line #L116 was not covered by tests
exit 1
fi

Expand Down
15 changes: 9 additions & 6 deletions src/codecov_ats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
echo -e "$1"
}

error() {
echo -e "${r}$*${e}" >&2

Check warning on line 17 in src/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

src/codecov_ats.sh#L17

Added line #L17 was not covered by tests
}

# Set up token variables
if [[ -n $INPUTS_CODECOV_TOKEN ]]; then
CODECOV_TOKEN=$INPUTS_CODECOV_TOKEN
fi
if [[ -z $CODECOV_TOKEN ]]; then
say "${r}Token not provided or could not be found in environment. Exiting${x}"
error "Token not provided or could not be found in environment. Exiting"

Check warning on line 25 in src/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

src/codecov_ats.sh#L25

Added line #L25 was not covered by tests
exit 1
else
say "$b==>$x Token of length ${#CODECOV_TOKEN} detected"
Expand All @@ -29,7 +32,7 @@
CODECOV_STATIC_TOKEN=$INPUTS_CODECOV_STATIC_TOKEN
fi
if [[ -z $CODECOV_STATIC_TOKEN ]]; then
say "${r}Static token not provided or could not be found in environment. Exiting${x}"
error "Static token not provided or could not be found in environment. Exiting"

Check warning on line 35 in src/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

src/codecov_ats.sh#L35

Added line #L35 was not covered by tests
exit 1
else
say "$b==>$x Static token of length ${#CODECOV_STATIC_TOKEN} detected"
Expand Down Expand Up @@ -73,22 +76,22 @@
if $(codecovcli ${codecovcli_args}create-commit ${create_commit_args}-t ${CODECOV_TOKEN}); then
say "${g}Codecov: Successfully created commit record$x"
else
say "${r}Codecov: Failed to properly create commit$x"
error "Codecov: Failed to properly create commit"

Check warning on line 79 in src/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

src/codecov_ats.sh#L79

Added line #L79 was not covered by tests
exit 1
fi

if $(codecovcli ${codecovcli_args}create-report ${create_report_args}-t ${CODECOV_TOKEN}); then
say "${g}Codecov: Successfully created report record$x"
else
say "${r}Codecov: Failed to properly create report$x"
error "Codecov: Failed to properly create report"

Check warning on line 86 in src/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

src/codecov_ats.sh#L86

Added line #L86 was not covered by tests
exit 1
fi

codecovcli ${codecovcli_args}static-analysis ${static_analysis_args}--token ${CODECOV_STATIC_TOKEN}
if [[ $? == 0 ]]; then
say "${g}Codecov: Successfully ran static analysis$x"
else
say "${r}Codecov: Failed to run static analysis$x"
error "Codecov: Failed to run static analysis"

Check warning on line 94 in src/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

src/codecov_ats.sh#L94

Added line #L94 was not covered by tests
exit 1
fi

Expand All @@ -110,7 +113,7 @@
done

if [[ -z $response && -n $INPUTS_OVERRIDE_BASE_COMMIT ]]; then
say "${r}Codecov: Failed to run label analysis. Please select a different base commit.$x"
error "Codecov: Failed to run label analysis. Please select a different base commit."

Check warning on line 116 in src/codecov_ats.sh

View check run for this annotation

Codecov / codecov/patch

src/codecov_ats.sh#L116

Added line #L116 was not covered by tests
exit 1
fi

Expand Down