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
|
||||
|
||||
util_path="${GITHUB_ACTION_PATH-.}/utils.sh"
|
||||
util_path="${GITHUB_ACTION_PATH:-.}/utils.sh"
|
||||
|
||||
# shellcheck source=utils.sh
|
||||
. "${util_path}"
|
||||
|
@ -50,7 +50,7 @@ markdown_from_report() {
|
|||
cat <<-"EOF"
|
||||
- `[NAR] Size Change`: the amount changed compared to the main branch
|
||||
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
|
||||
cat <<-"EOF"
|
||||
# NixOS Configurations
|
||||
|
@ -96,14 +96,14 @@ markdown_from_report() {
|
|||
}
|
||||
|
||||
# Test outside CI
|
||||
if [ "${CI-false}" != 'true' ]; then
|
||||
if [ "${CI:-false}" != 'true' ]; then
|
||||
markdown_from_report "$@"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
log 'Determine 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"
|
||||
prs=$(curl -X 'GET' \
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set -eu
|
||||
|
||||
util_path="${GITHUB_ACTION_PATH-.}/utils.sh"
|
||||
util_path="${GITHUB_ACTION_PATH:-.}/utils.sh"
|
||||
|
||||
# shellcheck source=utils.sh
|
||||
. "${util_path}"
|
||||
|
|
|
@ -38,7 +38,7 @@ has_report() {
|
|||
}
|
||||
|
||||
# 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
|
||||
url=$(base_report_url "$base_branch")
|
||||
|
|
Loading…
Reference in a new issue