From f7e6e01743be350344bcf1e5eed4ded7ebd1833d Mon Sep 17 00:00:00 2001 From: "Kenta Goto (k.goto)" <24818752+go-to-k@users.noreply.github.com> Date: Sun, 18 Aug 2024 21:04:42 +0900 Subject: [PATCH] ci: fix bug that labels are not created (#391) --- .github/workflows/semantic-pull-request.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/semantic-pull-request.yml b/.github/workflows/semantic-pull-request.yml index ff4cdf22..10c1079f 100644 --- a/.github/workflows/semantic-pull-request.yml +++ b/.github/workflows/semantic-pull-request.yml @@ -59,15 +59,15 @@ jobs: run: | EXISTING_LABELS=$(gh label list --json name --jq '.[].name') - if ! echo "$EXISTING_LABELS" | grep -q "$MINOR_LABEL"; then + if ! echo "$EXISTING_LABELS" | grep -qx "$MINOR_LABEL"; then gh label create "$MINOR_LABEL" --color "$MINOR_LABEL_COLOR" fi - if ! echo "$EXISTING_LABELS" | grep -q "$MAJOR_LABEL"; then + if ! echo "$EXISTING_LABELS" | grep -qx "$MAJOR_LABEL"; then gh label create "$MAJOR_LABEL" --color "$MAJOR_LABEL_COLOR" fi - if ! echo "$EXISTING_LABELS" | grep -q "$PATCH_LABEL"; then + if ! echo "$EXISTING_LABELS" | grep -qx "$PATCH_LABEL"; then gh label create "$PATCH_LABEL" --color "$PATCH_LABEL_COLOR" fi - name: Manage labels based on PR title @@ -77,9 +77,9 @@ jobs: LABELS=$(gh pr view $PR_NUMBER --json labels --jq '.labels[].name') - HAS_MINOR_LABEL=$(echo "$LABELS" | grep -q "$MINOR_LABEL" && echo "true" || echo "false") - HAS_MAJOR_LABEL=$(echo "$LABELS" | grep -q "$MAJOR_LABEL" && echo "true" || echo "false") - HAS_PATCH_LABEL=$(echo "$LABELS" | grep -q "$PATCH_LABEL" && echo "true" || echo "false") + HAS_MINOR_LABEL=$(echo "$LABELS" | grep -qx "$MINOR_LABEL" && echo "true" || echo "false") + HAS_MAJOR_LABEL=$(echo "$LABELS" | grep -qx "$MAJOR_LABEL" && echo "true" || echo "false") + HAS_PATCH_LABEL=$(echo "$LABELS" | grep -qx "$PATCH_LABEL" && echo "true" || echo "false") if [ "$HAS_MAJOR_LABEL" = "true" ]; then if [ "$HAS_PATCH_LABEL" = "true" ];then