Skip to content

Commit

Permalink
Terraform managed file
Browse files Browse the repository at this point in the history
  • Loading branch information
vagrant-bot committed Apr 7, 2023
1 parent b77fb6a commit 9dd8bf8
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .ci/.ci-utility-files/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function output_file() {
function debug() {
if [ -n "${DEBUG}" ]; then
local msg_template="${1}"
local i=$(( "${#}" - 1 ))
local i=$(( ${#} - 1 ))
local msg_args=("${@:2:$i}")
# Update template to include caller information
msg_template=$(printf "<%s(%s:%d)> %s" "${FUNCNAME[1]}" "${BASH_SOURCE[1]}" "${BASH_LINENO[0]}" "${msg_template}")
Expand All @@ -178,7 +178,7 @@ function debug() {
# $1: Failure message
function failure() {
local msg_template="${1}"
local i=$(( "${#}" - 1 ))
local i=$(( ${#} - 1 ))
local msg_args=("${@:2:$i}")

#shellcheck disable=SC2059
Expand All @@ -202,7 +202,7 @@ function failure() {
# $1: Warning message
function warn() {
local msg_template="${1}"
local i=$(( "${#}" - 1 ))
local i=$(( ${#} - 1 ))
local msg_args=("${@:2:$i}")

#shellcheck disable=SC2059
Expand All @@ -222,7 +222,7 @@ function warn() {
# Write an informational message
function info() {
local msg_template="${1}\n"
local i=$(( "${#}" - 1 ))
local i=$(( ${#} - 1 ))
local msg_args=("${@:2:$i}")

#shellcheck disable=SC2059
Expand All @@ -237,7 +237,7 @@ function info() {
# $@{1:$#-1}: Command to execute
# $@{$#}: Failure message
function wrap() {
local i=$(("${#}" - 1))
local i=$((${#} - 1))
if ! wrap_raw "${@:1:$i}"; then
cat "$(output_file)"
failure "${@:$#}"
Expand All @@ -262,7 +262,7 @@ function wrap_raw() {
# $@{1:$#-1}: Command to execute
# $@{$#}: Failure message
function wrap_stream() {
i=$(("${#}" - 1))
i=$((${#} - 1))
if ! wrap_stream_raw "${@:1:$i}"; then
failure "${@:$#}"
fi
Expand Down Expand Up @@ -2620,8 +2620,10 @@ elif [ -n "${GITHUB_TOKEN}" ]; then
priv_args+=("-H" "Authorization: token ${HASHIBOT_TOKEN}")
fi

priv_check="$(curl "${priv_args[@]}" -s "https://api.github.com/repos/${GITHUB_REPOSITORY}" | jq .private)" ||
failure "Repository visibility check failed"
if [ -n "${GITHUB_ACTIONS}" ]; then
priv_check="$(curl "${priv_args[@]}" -s "https://api.github.com/repos/${GITHUB_REPOSITORY}" | jq .private)" ||
failure "Repository visibility check failed"
fi

# If the value wasn't true we unset it to indicate not private. The
# repository might actually be private but we weren't supplied a
Expand Down

0 comments on commit 9dd8bf8

Please sign in to comment.