diff --git a/action.yml b/action.yml index 03b6119..1edd02a 100644 --- a/action.yml +++ b/action.yml @@ -7,7 +7,7 @@ inputs: required: false description: | Directory to run the action on, from the repo root. - Default is . ( root of the repository) + Default is . (root of the repository) default: "." version: required: false @@ -20,7 +20,7 @@ inputs: additional_args: required: false description: | - Space seperated args specified here will be added during tfsec execution. + Space separated args specified here will be added during tfsec execution. (eg. --force-all-dirs --verbose) soft_fail: required: false diff --git a/entrypoint.sh b/entrypoint.sh index 90c5485..0d0bc0e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,7 +3,7 @@ set -xe if [ -z "${INPUT_GITHUB_TOKEN}" ] ; then - echo "Consider setting a GITHUB_TOKEN to prevent GitHub api rate limits." >&2 + echo "::notice title=GitHub API token::Consider setting a GITHUB_TOKEN to prevent GitHub api rate limits" fi TFSEC_VERSION="" @@ -21,14 +21,13 @@ function get_release_assets() { --header "Accept: application/vnd.github+json" ) [ -n "${INPUT_GITHUB_TOKEN}" ] && args+=(--header "Authorization: Bearer ${INPUT_GITHUB_TOKEN}") - api_request="$(curl -sfS "${args[@]}" "https://api.github.com/repos/${repo}/releases/${version}")" - if [[ $? != 0 ]]; then - echo "The request to the GitHub API was likely rate-limited; consider setting a GITHUB_TOKEN to prevent this" >&2 + if ! curl --fail-with-body -sS "${args[@]}" "https://api.github.com/repos/${repo}/releases/${version}"; then + echo "::error title=GitHub API request failure::The request to the GitHub API was likely rate-limited. Set a GITHUB_TOKEN to prevent this" exit 1 + else + curl "${args[@]}" "https://api.github.com/repos/${repo}/releases/${version}" | jq '.assets[] | { name: .name, download_url: .browser_download_url }' fi - - echo "${api_request}" | jq '.assets[] | { name: .name, download_url: .browser_download_url }' } function install_release() {