Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#461): 🐛 issue with pull request labels with emoji and space #462

Merged
merged 2 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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