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 23eda37 commit 9e63083
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,7 @@ jobs:
- name: Check PR labels
env:
LABEL_NAMES: ${{ toJson(github.event.pull_request.labels.*.name) }}
if: contains(env.LABEL_NAMES, 'pending review') == contains(env.LABEL_NAMES, 'in progress')
run: |
# 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
echo "PR must have "exactly one" of these labels: ['pending review', 'in progress']."
exit 1

0 comments on commit 9e63083

Please sign in to comment.