From 0dcb9d903e689c38e90103421af0b99d614b61ba Mon Sep 17 00:00:00 2001 From: Andy Augustin Date: Sun, 25 Feb 2024 20:10:55 +0100 Subject: [PATCH] fix(#461): :bug: issue with pull request labels with emoji and space --- .github/workflows/actions_template_sync.yml | 2 +- Dockerfile | 2 +- src/Dockerfile | 2 +- src/sync_template.sh | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/actions_template_sync.yml b/.github/workflows/actions_template_sync.yml index 1ae97ce1..fd69cebe 100644 --- a/.github/workflows/actions_template_sync.yml +++ b/.github/workflows/actions_template_sync.yml @@ -24,4 +24,4 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} source_repo_path: AndreasAugustin/template upstream_branch: main # defaults to main - pr_labels: chore,template-sync,example + pr_labels: chore,📚 template-sync,example diff --git a/Dockerfile b/Dockerfile index 3ddeca05..5a871c8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ ###################################### FROM alpine:3.19.1 as dev -ARG GH_CLI_VER=2.34.0 +ARG GH_CLI_VER=2.44.1 # install packages RUN apk add --update --no-cache bash make git zsh curl tmux musl openssh git-lfs vim yq gnupg tig diff --git a/src/Dockerfile b/src/Dockerfile index 3799db38..34fd654a 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:3.19.1 -ARG GH_CLI_VER=2.34.0 +ARG GH_CLI_VER=2.44.1 # TODO(anau) change user ARG GITHUB_URL="https://github.com/AndreasAugustin/actions-template-sync" diff --git a/src/sync_template.sh b/src/sync_template.sh index d4cb6921..d528b44b 100644 --- a/src/sync_template.sh +++ b/src/sync_template.sh @@ -178,8 +178,8 @@ echo "::endgroup::" function maybe_create_labels () { - all_labels=${PR_LABELS//,/$'\n'} - for label in $all_labels + readarray -t labels_array < <(awk -F',' '{ for( i=1; i<=NF; i++ ) print $i }' <<<"${PR_LABELS}") + for label in "${labels_array[@]}" do search_result=$(gh label list \ --search "${label}" \ @@ -187,8 +187,8 @@ function maybe_create_labels () { --json name \ --template '{{range .}}{{printf "%v" .name}}{{"\n"}}{{end}}') - if [ "${search_result}" = "${label}" ]; then - info "label '${label}' was found in the repository" + if [ "${search_result}" = "${label##[[:space:]]}" ]; then + info "label '${label##[[:space:]]}' was found in the repository" else gh label create "${label}" info "label '${label}' was missing and has been created"