Skip to content

Commit

Permalink
☁️ chore(automation): Applying changes from upstream repository.
Browse files Browse the repository at this point in the history
  • Loading branch information
Megabyte Labs committed Sep 27, 2022
1 parent 383b585 commit da3dde3
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 61 deletions.
89 changes: 47 additions & 42 deletions .config/log
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ if [ "${container:=}" != 'docker' ]; then
fi
fi

# @description Disable logging for Semantic Release because it tries to parse it as JSON
if [ -n "$SEMANTIC_RELEASE" ]; then
NO_LOGGING=true
fi

# @description Logs using Node.js
# @example logger info "An informative log"
logger() {
Expand Down Expand Up @@ -208,12 +213,12 @@ confirm() {
# @description Logs an error message
# @example .config/log error "Something happened!"
error() {
if [ -n "$SEMANTIC_RELEASE" ]; then
echo "ERROR $1"
elif [ -n "$ENHANCED_LOGGING" ]; then
logger error "$1"
else
echo -e "\e[1;41m ERROR \e[0m $(format "$1")\e[0;39m"
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger error "$1"
else
echo -e "\e[1;41m ERROR \e[0m $(format "$1")\e[0;39m"
fi
fi
}

Expand All @@ -231,12 +236,12 @@ filter() {
# @description Logs an info message
# @example .config/log info "Here is some information"
info() {
if [ -n "$SEMANTIC_RELEASE" ]; then
echo "INFO $1"
elif [ -n "$ENHANCED_LOGGING" ]; then
logger info "$1"
else
echo -e "\e[1;46m INFO \e[0m $(format "$1")\e[0;39m"
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger info "$1"
else
echo -e "\e[1;46m INFO \e[0m $(format "$1")\e[0;39m"
fi
fi
}

Expand Down Expand Up @@ -283,12 +288,12 @@ password() {
# @description Logs a message that describes a prompt
# @example .config/log prompt "Enter text into the following prompt"
prompt() {
if [ -n "$SEMANTIC_RELEASE" ]; then
echo "PROMPT $1"
elif [ -n "$ENHANCED_LOGGING" ]; then
logger prompt "$1"
else
echo -e "\e[1;104m PROMPT \e[0m $(format "$1")\e[0;39m"
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger prompt "$1"
else
echo -e "\e[1;104m PROMPT \e[0m $(format "$1")\e[0;39m"
fi
fi
}

Expand All @@ -311,48 +316,48 @@ spin() {
# @description Logs a message that starts with a star emoji
# @example .config/log star "Congratulations"
star() {
if [ -n "$SEMANTIC_RELEASE" ]; then
echo "STAR $1"
elif [ -n "$ENHANCED_LOGGING" ]; then
logger star "$1"
else
echo -e "\e[1;104m LINK \e[0m $(format "$1")\e[0;39m"
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger star "$1"
else
echo -e "\e[1;104m LINK \e[0m $(format "$1")\e[0;39m"
fi
fi
}

# @description Logs a message at the beginning of a task
# @example .config/log start "Starting the process.."
start() {
if [ -n "$SEMANTIC_RELEASE" ]; then
echo "START $1"
elif [ -n "$ENHANCED_LOGGING" ]; then
logger start "$1"
else
echo -e "\e[1;46m START \e[0m $(format "$1")\e[0;39m"
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger start "$1"
else
echo -e "\e[1;46m START \e[0m $(format "$1")\e[0;39m"
fi
fi
}

# @description Logs a success message
# @example .config/log success "Yay!"
success() {
if [ -n "$SEMANTIC_RELEASE" ]; then
echo "SUCCESS $1"
elif [ -n "$ENHANCED_LOGGING" ]; then
logger success "$1"
else
echo -e "\e[1;42m SUCCESS \e[0m $(format "$1")\e[0;39m"
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger success "$1"
else
echo -e "\e[1;42m SUCCESS \e[0m $(format "$1")\e[0;39m"
fi
fi
}

# @description Logs a warning message
# @example .config/log warn "Just so you know.."
warn() {
if [ -n "$SEMANTIC_RELEASE" ]; then
echo "WARNING $1"
elif [ -n "$ENHANCED_LOGGING" ]; then
logger warn "$1"
else
echo -e "\e[1;43m WARNING \e[0m $(format "$1")\e[0;39m"
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger warn "$1"
else
echo -e "\e[1;43m WARNING \e[0m $(format "$1")\e[0;39m"
fi
fi
}

Expand Down
6 changes: 3 additions & 3 deletions .config/taskfiles/ci/Taskfile-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ tasks:
synchronize:
deps:
- :install:software:git
env:
GITHUB_HTTP_REPO:
sh: jq -r '.blueprint.repository.github' package.json
summary: |
Forces a push to the GitHub master branch so that GitHub stays mirrored with
the GitLab master branch.
env:
GITHUB_HTTP_REPO:
sh: jq -r '.blueprint.repository.github' package.json
cmds:
- cmd: |
if [ "$GITHUB_HTTP_REPO" != 'null' ]; then
Expand Down
2 changes: 1 addition & 1 deletion .config/taskfiles/docker/Taskfile-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ tasks:
- grep 'org.opencontainers.image.documentation' Dockerfile

# yamllint disable rule:line-length
# eslint-disable max-len

labels:update:
vars:
AUTHORS:
Expand Down
1 change: 0 additions & 1 deletion .config/taskfiles/release/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ tasks:
status:
- '[ "$SNAP_PACKAGE" == "null" ]'

# eslint-disable max-len
analyze:
summary: |
| Command property | Description |
Expand Down
Loading

0 comments on commit da3dde3

Please sign in to comment.