vitess.io/vitess@v0.16.2/.github/workflows/check_label.yml (about)

     1  name: Check Pull Request labels
     2  on:
     3    pull_request:
     4      types: [opened, labeled, unlabeled, synchronize]
     5  
     6  concurrency:
     7    group: format('{0}-{1}', ${{ github.ref }}, 'Check Pull Request labels')
     8    cancel-in-progress: true
     9  
    10  jobs:
    11    check_pull_request_labels:
    12      name: Check Pull Request labels
    13      timeout-minutes: 10
    14      runs-on: ubuntu-22.04
    15      if: github.repository == 'vitessio/vitess'
    16      steps:
    17        - name: Release Notes label
    18          run: |
    19            if [[ "${{contains( github.event.pull_request.labels.*.name, 'release notes (needs details)')}}" == "true" ]]; then
    20              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/16.0/16.0.1/summary.md')". Once documented, the "release notes (needs details)" label can be removed.
    21              exit 1
    22            fi
    23  
    24        - name: Check type and component labels
    25          env:
    26            PR_NUMBER: ${{ github.event.pull_request.number }}
    27          run: |
    28            LABELS_JSON="/tmp/labels.json"
    29            # Get labels for this pull request
    30            curl -s \
    31              -H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
    32              -H "Accept: application/vnd.github.v3+json" \
    33              -H "Content-type: application/json" \
    34              "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels" \
    35              > "$LABELS_JSON"
    36            if ! cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'Component:' ; then
    37              echo "Expecting PR to have label 'Component: ...'"
    38              exit 1
    39            fi
    40            if ! cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'Type:' ; then
    41              echo "Expecting PR to have label 'Type: ...'"
    42              exit 1
    43            fi
    44  
    45        - name: Check NeedsWebsiteDocsUpdate and NeedsDescriptionUpdate are off
    46          env:
    47            PR_NUMBER: ${{ github.event.pull_request.number }}
    48          run: |
    49            LABELS_JSON="/tmp/labels.json"
    50            # Get labels for this pull request
    51            curl -s \
    52              -H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
    53              -H "Accept: application/vnd.github.v3+json" \
    54              -H "Content-type: application/json" \
    55              "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels" \
    56              > "$LABELS_JSON"
    57            if cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'NeedsDescriptionUpdate' ; then
    58              echo "Expecting PR to not have the NeedsDescriptionUpdate label, please update the PR's description and remove the label."
    59              exit 1
    60            fi
    61            if cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'NeedsWebsiteDocsUpdate' ; then
    62              echo "Expecting PR to not have the NeedsWebsiteDocsUpdate label, please update the documentation and remove the label."
    63              exit 1
    64            fi
    65            
    66  
    67        - name: Do Not Merge label
    68          run: |
    69            if [[ "${{contains( github.event.pull_request.labels.*.name, 'Do Not Merge')}}" == "true" ]]; then
    70              echo "This PR should not be merged. The 'Do Not Merge' label is set. Please unset it if you wish to merge this PR."
    71              exit 1
    72            fi