Add release and PR title checks, shared CI scripts, Gitea PR template, and align pyproject.toml to v0.3.1. Co-authored-by: Cursor <[email protected]>
42 lines
984 B
Bash
Executable File
42 lines
984 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
# shellcheck source=common.sh
|
|
source "${SCRIPT_DIR}/common.sh"
|
|
|
|
PR_TITLE="${1:-${PR_TITLE:-}}"
|
|
|
|
if [[ -z "$PR_TITLE" ]]; then
|
|
echo "Usage: check-pr-title.sh <pr-title> (changed files on stdin)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
CHANGED_FILES=$(cat)
|
|
|
|
if ! has_source_changes "$CHANGED_FILES"; then
|
|
echo "No changes under ${SOURCE_DIR}/ — PR title prefix not required."
|
|
exit 0
|
|
fi
|
|
|
|
if title_has_bump_prefix "$PR_TITLE"; then
|
|
echo "PR title has a valid version bump prefix."
|
|
exit 0
|
|
fi
|
|
|
|
cat >&2 <<EOF
|
|
PR changes files under ${SOURCE_DIR}/ but the title lacks a version bump prefix.
|
|
|
|
Title: ${PR_TITLE}
|
|
|
|
When changing package source, start the PR title with one of:
|
|
[patch] or [fix] — bug fix
|
|
[minor] or [feat] — new feature
|
|
[major] or [breaking] — breaking change
|
|
|
|
Example: [patch] Fix connection retry in RedisAdapter
|
|
|
|
See .gitea/PULL_REQUEST_TEMPLATE.md for details.
|
|
EOF
|
|
exit 1
|