Skip to content

fix PrimaryIsNotServing logic #39260

fix PrimaryIsNotServing logic

fix PrimaryIsNotServing logic #39260

Workflow file for this run

name: Check Pull Request labels
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
permissions: read-all
jobs:
check_pull_request_labels:
name: Check Pull Request labels
timeout-minutes: 10
runs-on: ubuntu-22.04
if: github.repository == 'vitessio/vitess'
steps:
- name: Release Notes label
run: |
if [[ "${{contains( github.event.pull_request.labels.*.name, 'release notes (needs details)')}}" == "true" ]]; then
echo The "release notes (needs details)" label is set. The changes made in this Pull Request need to be documented in the release notes summary "('./changelog/17.0/17.0.0/summary.md')". Once documented, the "release notes (needs details)" label can be removed.
exit 1
fi
- name: Check type and component labels
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
LABELS_JSON="/tmp/labels.json"
# Get labels for this pull request
curl -s \
-H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-type: application/json" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels" \
> "$LABELS_JSON"
if ! cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'Component:' ; then
echo "Expecting PR to have label 'Component: ...'"
exit 1
fi
if ! cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'Type:' ; then
echo "Expecting PR to have label 'Type: ...'"
exit 1
fi
- name: Check all Needs labels are off
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
LABELS_JSON="/tmp/labels.json"
# Get labels for this pull request
curl -s \
-H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-type: application/json" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels" \
> "$LABELS_JSON"
if cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'NeedsDescriptionUpdate' ; then
echo "Expecting PR to not have the NeedsDescriptionUpdate label, please update the PR's description and remove the label."
exit 1
fi
if cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'NeedsWebsiteDocsUpdate' ; then
echo "Expecting PR to not have the NeedsWebsiteDocsUpdate label, please update the documentation and remove the label."
exit 1
fi
if cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'NeedsIssue' ; then
echo "Expecting PR to not have the NeedsIssue label; please create a linked issue and remove the label."
exit 1
fi
if cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'NeedsBackportReason' ; then
if cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'Backport to:'; then
echo "Expecting PR to not have the NeedsBackportReason label; please add your justification to the PR description and remove the label."
exit 1
fi
fi
- name: Do Not Merge label
run: |
if [[ "${{contains( github.event.pull_request.labels.*.name, 'Do Not Merge')}}" == "true" ]]; then
echo "This PR should not be merged. The 'Do Not Merge' label is set. Please unset it if you wish to merge this PR."
exit 1
fi