Skip to content

Planning implementation steps for core modules #137

Planning implementation steps for core modules

Planning implementation steps for core modules #137

name: Validate PR Version Targeting
# Rechenaufwand-Score: R=2 (K=2, L=2, N=2) | last-calibrated: 2026-08-25
# Trigger policy: repo framework score calibration for workflow cost controls.
# Runs on PR open/sync to validate Target Version field and milestone assignment
on:
pull_request:
types: [opened, edited, synchronize]
permissions:
pull-requests: read
contents: read
jobs:
validate-target-version:
name: Validate PR Version Targeting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Extract Target Version from PR body
id: extract_version
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
TARGET_VERSION=$(PR_BODY="$PR_BODY" python3 - <<'PY'
import os
import re
body = os.environ.get("PR_BODY", "")
match = re.search(r'^\*\*Target Version:\*\*\s*(?:\(([^)]+)\)|([^\n]+))\s*$', body, re.MULTILINE)
version = ""
if match:
version = (match.group(1) or match.group(2) or "").strip()
print(version)
PY
)
echo "Target Version extracted: '$TARGET_VERSION'"
if [[ -z "$TARGET_VERSION" ]]; then
echo "::warning::PR does not have a Target Version specified. Defaulting to '[Unreleased]'. Fill in the 'Target Version' field in the PR template before merge."
TARGET_VERSION="[Unreleased]"
fi
echo "target_version=$TARGET_VERSION" >> "$GITHUB_OUTPUT"
- name: Validate Target Version format
id: validate_format
run: |
VERSION="${{ steps.extract_version.outputs.target_version }}"
# Valid formats: v2.4.0, v2.4.1, v2.5.0-alpha1, v2.5.0-beta1, v2.5.0-rc1, [Unreleased]
PATTERN='^(v[0-9]+\.[0-9]+\.[0-9]+(-alpha[0-9]+|-beta[0-9]+|-rc[0-9]+)?|\[Unreleased\])$'
if [[ ! "$VERSION" =~ $PATTERN ]]; then
echo "::error::Invalid Target Version format: '$VERSION'. Must match SemVer (v2.4.0, v2.5.0-alpha1, etc.) or '[Unreleased]'"
exit 1
fi
echo "valid_format=true" >> "$GITHUB_OUTPUT"
echo "✓ Target Version format is valid: $VERSION"
- name: Check if milestone exists (informational)
id: check_milestone
run: |
VERSION="${{ steps.extract_version.outputs.target_version }}"
PR_NUMBER="${{ github.event.pull_request.number }}"
echo "ℹ️ Target Version: $VERSION"
echo "ℹ️ PR #$PR_NUMBER"
echo ""
echo "After merge, this PR should be assigned to the '$VERSION' milestone."
echo "See docs/governance/PR_VERSION_TARGETING.md for more details."
- name: Summary
run: |
echo "✓ PR version targeting validation passed"
echo " Target Version: ${{ steps.extract_version.outputs.target_version }}"
echo ""
echo "Next steps for reviewers:"
echo " 1. Verify the Target Version is correct for this PR's scope"
echo " 2. Check that the milestone exists on GitHub (see docs/governance/GITHUB_MILESTONES_SETUP.md)"
echo " 3. Upon merge, assign this PR to the corresponding milestone"