Skip to content

Add enhancement proposal for controlling external seeds #4012

Add enhancement proposal for controlling external seeds

Add enhancement proposal for controlling external seeds #4012

Workflow file for this run

# Copyright (C) 2021 ScyllaDB
name: Verify PR
on:
pull_request:
branches:
- '**'
# GitHub doesn't allow to trigger directly when editing a milestone yet.
# https://gh.neting.ccmunity/t/feature-request-add-milestone-changes-as-activity-type-to-pull-request/16778/7
#
# We have to verify PR milestone in pull_request and we can't use do-not-merge/ label
# because it needs to react to master branch changes (when master starts being a different version).
# Also GH doesn't trigger on labels created with action token.
types:
- labeled
- unlabeled
- opened
- edited
- reopened
- synchronize
jobs:
title:
name: Verify PR title
runs-on: ubuntu-22.04
steps:
- name: Verify PR title
run: |
set -euExo pipefail
shopt -s inherit_errexit
pr_title=$( jq -r '.pull_request.title' "${GITHUB_EVENT_PATH}" )
if echo "${pr_title}" | grep -E \
-e '^\[WIP\]' \
-e '^\[DO NOT MERGE\]' \
; then
echo "The PR title indicates it shouldn't be merged."
exit 1
fi
base_branch=$( jq -r '.pull_request.base.ref' "${GITHUB_EVENT_PATH}" )
pr_title_branch=$( echo "${pr_title}" | sed -E -e 's/(\[WIP\]|\[DO NOT MERGE\])?(\[([^]].*)\])?.*/\3/' )
if [[ "${base_branch}" == "master" ]]; then
if [[ "${pr_title_branch}" != "" ]]; then
echo "PRs to master branch are not expected to have title prefix [${pr_title_branch}]."
exit 1
fi
else
if [[ "${pr_title_branch}" != "${base_branch}" ]]; then
echo "PRs to ${base_branch} must have the title starting with '[${base_branch}]' prefix."
exit 1
fi
fi
labels:
name: Verify PR labels
runs-on: ubuntu-22.04
steps:
- name: Verify PR labels
run: |
set -euExo pipefail
shopt -s inherit_errexit
labels_json=$( jq -r '[.pull_request.labels[] | .name]' "${GITHUB_EVENT_PATH}" )
kind_labels=( $( jq -r '.[] | select(startswith("kind/"))' <( echo "${labels_json}" ) ) )
if [[ "${#kind_labels[@]}" == "0" ]]; then
echo 'Missing kind/* label'
exit 1
fi
milestone:
name: Verify PR milestone
if: ${{ github.event.pull_request.base.ref == 'master' }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Verify PR milestone
run: |
set -euExo pipefail
shopt -s inherit_errexit
expected_milestone=$( git describe --abbrev=0 | sed -E -e 's/(v[0-9]+\.[0-9]+)\.[0-9]+.*/\1/' )
[[ "${expected_milestone}" != "" ]]
current_milestone=$( jq -r '.pull_request.milestone.title // empty' "${GITHUB_EVENT_PATH}" )
if [[ "${current_milestone}" != "${expected_milestone}" ]]; then
echo "Expected milestone '${expected_milestone}' but PR has milestone '${current_milestone}'."
exit 1
fi