Skip to content

Commit

Permalink
refactor: ♻️ enhance readability
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasAugustin committed Feb 4, 2024
1 parent 7abe03e commit ebdd9ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/sync_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -e
# Arguments:
# message to print.
#######################################
err() {
function err() {
echo "::error::[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" >&2;
}

Expand All @@ -18,7 +18,7 @@ err() {
# Arguments:
# message to print.
#######################################
debug() {
function debug() {
echo "::debug::$*";
}

Expand All @@ -27,7 +27,7 @@ debug() {
# Arguments:
# message to print.
#######################################
warn() {
function warn() {
echo "::warn::$*";
}

Expand All @@ -36,7 +36,7 @@ warn() {
# Arguments:
# message to print.
#######################################
info() {
function info() {
echo "::info::$*";
}

Expand All @@ -46,7 +46,7 @@ info() {
# hook -> the hook to use
#
####################################3#
cmd_from_yml_file() {
function cmd_from_yml_file() {
local FILE_NAME="templatesync.yml"
local HOOK=$1
local YML_PATH=".hooks.${HOOK}.commands"
Expand Down
10 changes: 5 additions & 5 deletions src/sync_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ debug "new Git HASH ${NEW_TEMPLATE_GIT_HASH}"

echo "::group::Check new changes"

check_branch_remote_existing() {
function check_branch_remote_existing() {
git ls-remote --exit-code --heads origin "${NEW_BRANCH}" || BRANCH_DOES_NOT_EXIST=true

if [[ "${BRANCH_DOES_NOT_EXIST}" != true ]]; then
Expand Down Expand Up @@ -143,7 +143,7 @@ git commit -m "${PR_COMMIT_MSG}"

echo "::endgroup::"

cleanup_older_prs () {
function cleanup_older_prs () {
older_prs=$(gh pr list \
--base "${UPSTREAM_BRANCH}" \
--state open \
Expand Down Expand Up @@ -177,7 +177,7 @@ fi
echo "::endgroup::"


maybe_create_labels () {
function maybe_create_labels () {
all_labels=${PR_LABELS//,/$'\n'}
for label in $all_labels
do
Expand Down Expand Up @@ -210,12 +210,12 @@ fi

echo "::endgroup::"

push () {
function push () {
debug "push changes"
git push --set-upstream origin "${NEW_BRANCH}"
}

create_pr () {
function create_pr () {
gh pr create \
--title "${PR_TITLE}" \
--body "Merge ${SOURCE_REPO_PATH} ${NEW_TEMPLATE_GIT_HASH}" \
Expand Down

0 comments on commit ebdd9ec

Please sign in to comment.