Skip to content

Commit

Permalink
fix(#461): 🐛 issue with pull request labels with emoji and space (#462)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasAugustin authored Feb 25, 2024
1 parent 43c12df commit 89b8d21
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions_template_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 4 additions & 4 deletions src/sync_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,17 @@ 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}" \
--limit 1 \
--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"
Expand Down

0 comments on commit 89b8d21

Please sign in to comment.