RFC: Session-Scoped Architecture for vMCP #118
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Validate Proposal Naming | |
| permissions: | |
| contents: read | |
| on: | |
| pull_request: | |
| paths: | |
| - 'rfcs/**' | |
| types: [opened, synchronize] | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: 'The PR number to validate the naming convention for' | |
| required: true | |
| type: string | |
| jobs: | |
| validate-proposal-naming: | |
| runs-on: ubuntu-slim | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set PR number | |
| run: | | |
| # Set PR_NUMBER based on context: use inputs.pr_number for manual dispatch, | |
| # otherwise use github.event.number for pull request events | |
| if [ -n "${{ inputs.pr_number }}" ]; then | |
| echo "PR_NUMBER=$(printf %04d ${{ inputs.pr_number }})" >> $GITHUB_ENV | |
| echo "Using PR number from manual input: $(printf %04d ${{ inputs.pr_number }})" | |
| else | |
| echo "PR_NUMBER=$(printf %04d ${{ github.event.number }})" >> $GITHUB_ENV | |
| echo "Using PR number from event: $(printf %04d ${{ inputs.pr_number }})" | |
| fi | |
| - name: Validate proposal naming | |
| run: | | |
| # Get the list of NEW files added in rfcs/ (not modifications to existing files) | |
| CHANGED_FILES=$(git diff --name-only --diff-filter=A origin/${{ github.base_ref }}...HEAD | grep '^rfcs/' || true) | |
| # Skip validation if no new proposal files are being added | |
| # (modifications to existing proposals don't need naming validation) | |
| if [ -z "$CHANGED_FILES" ]; then | |
| echo "ℹ️ No new proposal files added in this PR (only modifications to existing proposals or manual trigger)" | |
| exit 0 | |
| fi | |
| echo "Checking proposal file naming convention..." | |
| echo "Files to check:" | |
| echo "$CHANGED_FILES" | |
| VALIDATION_FAILED=false | |
| # Check each changed file | |
| while IFS= read -r file; do | |
| if [ -n "$file" ] && [ -f "$file" ]; then | |
| filename=$(basename "$file") | |
| echo "Checking file: $filename" | |
| # Check if the filename follows the THV-####-name pattern with the current PR number | |
| if echo "$filename" | grep -qE "^THV-${PR_NUMBER}-.*\.md$"; then | |
| echo "✅ $filename follows the correct naming convention" | |
| else | |
| echo "❌ $filename does not follow the correct naming convention" | |
| echo " Expected format: THV-${PR_NUMBER}-name-of-your-proposal.md" | |
| echo " Where ${PR_NUMBER} is the current PR number" | |
| VALIDATION_FAILED=true | |
| fi | |
| fi | |
| done <<< "$CHANGED_FILES" | |
| # Check if any validation failed | |
| if [ "$VALIDATION_FAILED" = "true" ]; then | |
| echo "" | |
| echo "❌ Validation failed! Some proposal files do not follow the naming convention." | |
| echo "" | |
| echo "Proposal files must follow this naming pattern:" | |
| echo " THV-${PR_NUMBER}-name-of-your-proposal.md" | |
| echo "" | |
| echo "Where:" | |
| echo " - THV- is the prefix" | |
| echo " - ${PR_NUMBER} is the current PR number" | |
| echo " - name-of-your-proposal is a descriptive name in kebab-case" | |
| echo " - .md is the file extension" | |
| echo "" | |
| echo "Example of valid name for this PR:" | |
| echo " - THV-${PR_NUMBER}-new-feature-proposal.md" | |
| echo "" | |
| exit 1 | |
| else | |
| echo "" | |
| echo "✅ All proposal files follow the correct naming convention!" | |
| fi |