fix(sh): ${VAR:-val} and ${VAR-val} are different
Who would've thought? `:` means or empty, so: ```sh VAR= echo "${VAR-default}" # prints 'default' VAR='' echo "${VAR-default}" # prints '' VAR='' echo "${VAR:-default}" # prints 'default' ``` ;-; nothing wants to work
This commit is contained in:
parent
b0b4030759
commit
cd38cd76fd
3 changed files with 6 additions and 6 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
util_path="${GITHUB_ACTION_PATH-.}/utils.sh"
|
util_path="${GITHUB_ACTION_PATH:-.}/utils.sh"
|
||||||
|
|
||||||
# shellcheck source=utils.sh
|
# shellcheck source=utils.sh
|
||||||
. "${util_path}"
|
. "${util_path}"
|
||||||
|
@ -50,7 +50,7 @@ markdown_from_report() {
|
||||||
cat <<-"EOF"
|
cat <<-"EOF"
|
||||||
- `[NAR] Size Change`: the amount changed compared to the main branch
|
- `[NAR] Size Change`: the amount changed compared to the main branch
|
||||||
EOF
|
EOF
|
||||||
compare=$(jq --slurp --from-file "${GITHUB_ACTION_PATH-.}/compare.jq" "$1" "$2")
|
compare=$(jq --slurp --from-file "${GITHUB_ACTION_PATH:-.}/compare.jq" "$1" "$2")
|
||||||
if echo "$compare" | has_elements 'nixosConfigurations'; then
|
if echo "$compare" | has_elements 'nixosConfigurations'; then
|
||||||
cat <<-"EOF"
|
cat <<-"EOF"
|
||||||
# NixOS Configurations
|
# NixOS Configurations
|
||||||
|
@ -96,14 +96,14 @@ markdown_from_report() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test outside CI
|
# Test outside CI
|
||||||
if [ "${CI-false}" != 'true' ]; then
|
if [ "${CI:-false}" != 'true' ]; then
|
||||||
markdown_from_report "$@"
|
markdown_from_report "$@"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log 'Determine head_ref'
|
log 'Determine head_ref'
|
||||||
# For push & tag events it'll bet GITHUB_REF_NAME, for pull_request events it'll be GITHUB_HEAD_REF
|
# For push & tag events it'll bet GITHUB_REF_NAME, for pull_request events it'll be GITHUB_HEAD_REF
|
||||||
head_ref=${GITHUB_REF_NAME-$GITHUB_HEAD_REF}
|
head_ref=${GITHUB_REF_NAME:-$GITHUB_HEAD_REF}
|
||||||
|
|
||||||
log "Get PR number for $head_ref"
|
log "Get PR number for $head_ref"
|
||||||
prs=$(curl -X 'GET' \
|
prs=$(curl -X 'GET' \
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
util_path="${GITHUB_ACTION_PATH-.}/utils.sh"
|
util_path="${GITHUB_ACTION_PATH:-.}/utils.sh"
|
||||||
|
|
||||||
# shellcheck source=utils.sh
|
# shellcheck source=utils.sh
|
||||||
. "${util_path}"
|
. "${util_path}"
|
||||||
|
|
|
@ -38,7 +38,7 @@ has_report() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# If a base branch is not provided, use the default branch
|
# If a base branch is not provided, use the default branch
|
||||||
base_branch=${BASE_BRANCH-$(default_branch)}
|
base_branch=${BASE_BRANCH:-$(default_branch)}
|
||||||
|
|
||||||
if [ "$(in_private_repo)" != 'true' ] && [ "$JOB_NAME" ]; then
|
if [ "$(in_private_repo)" != 'true' ] && [ "$JOB_NAME" ]; then
|
||||||
url=$(base_report_url "$base_branch")
|
url=$(base_report_url "$base_branch")
|
||||||
|
|
Loading…
Reference in a new issue