From fcc00e9b9a326d21ab10e0135c491800c2537491 Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Fri, 28 Jun 2024 16:09:11 -0500 Subject: [PATCH] arrays are hard --- .github/workflows/label-checker.yaml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/label-checker.yaml b/.github/workflows/label-checker.yaml index bc57c981a975..2f59370bc1f7 100644 --- a/.github/workflows/label-checker.yaml +++ b/.github/workflows/label-checker.yaml @@ -29,8 +29,11 @@ jobs: for label in $(yq -r '.changelog.categories[] | select(.title != "Uncategorized") | .labels[]' .github/release.yml); do labels+=("$label") done - echo "Required labels: $labels" - echo "required_labels=$labels" >> $GITHUB_OUTPUT + + labels_string=$(IFS=, ; echo "${labels[*]}") + + echo "Required labels: $labels_string" + echo "required_labels=$labels_string" >> $GITHUB_OUTPUT - name: Get PR labels id: get-pr-labels @@ -39,8 +42,11 @@ jobs: for label in $(jq -r '.pull_request.labels[].name' "$GITHUB_EVENT_PATH"); do labels+=("$label") done - echo "PR labels: $labels" - echo "labels=$labels" >> $GITHUB_OUTPUT + + labels_string=$(IFS=, ; echo "${labels[*]}") + + echo "PR labels: $labels_string" + echo "labels=$labels_string" >> $GITHUB_OUTPUT - name: Check for specific labels id: check-label @@ -48,6 +54,9 @@ jobs: required_labels="${{ steps.get-required-labels.outputs.required_labels }}" pr_labels="${{ steps.get-pr-labels.outputs.labels }}" + IFS=',' read -r -a required_labels_array <<< "$required_labels" + IFS=',' read -r -a pr_labels_array <<< "$pr_labels" + found=false for required_label in "${required_labels_array[@]}"; do for pr_label in "${pr_labels_array[@]}"; do