Skip to content

Commit

Permalink
update statuses list
Browse files Browse the repository at this point in the history
  • Loading branch information
laruh committed Dec 16, 2024
1 parent 4e18a85 commit 23eda37
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,27 @@ jobs:
- name: Check PR labels
env:
LABEL_NAMES: ${{ toJson(github.event.pull_request.labels.*.name) }}
if: "((contains(env.LABEL_NAMES, 'status: pending review') && (contains(env.LABEL_NAMES, 'status: in progress') == false) && (contains(env.LABEL_NAMES, 'status: blocked') == false)) || ((contains(env.LABEL_NAMES, 'status: pending review') == false) && contains(env.LABEL_NAMES, 'status: in progress') && (contains(env.LABEL_NAMES, 'status: blocked') == false)) || ((contains(env.LABEL_NAMES, 'status: pending review') == false) && (contains(env.LABEL_NAMES, 'status: in progress') == false) && contains(env.LABEL_NAMES, 'status: blocked'))) == false"
run: |
echo "$LABEL_NAMES"
echo "PR must have exactly one of these labels: ['status: pending review', 'status: in progress', 'status: blocked']."
exit 1
# Define the allowed status labels
ALLOWED_LABELS=("status: pending review" "status: in progress")
# Convert LABEL_NAMES (which is JSON) into a bash-readable array
LABEL_ARRAY=($(echo "${LABEL_NAMES}" | jq -r '.[]'))
count=0
for allowed_label in "${ALLOWED_LABELS[@]}"; do
for pr_label in "${LABEL_ARRAY[@]}"; do
if [ "$pr_label" = "$allowed_label" ]; then
count=$((count+1))
fi
done
done
# We want exactly one match
if [ $count -ne 1 ]; then
echo "PR must have exactly one of these labels: ${ALLOWED_LABELS[*]}."
echo "Found labels: ${LABEL_ARRAY[*]}"
exit 1
else
echo "PR has the valid status label."
fi

0 comments on commit 23eda37

Please sign in to comment.