Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/validate-proposal-naming.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Validate Proposal Naming
permissions:
contents: read

on:
pull_request:
paths:
- '**'
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 (not modifications to existing files)
CHANGED_FILES=$(git diff --name-only --diff-filter=A origin/${{ github.base_ref }}...HEAD | grep '^THV-' || 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
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work

# IDE specific files
.idea/
.vscode/
*.swp
*.swo

# Build output
/bin/
/dist/
/coverage/

.roo/
^thv$

.claude/settings.local.json
kconfig.yaml

.DS_Store

cmd/thv-operator/.task/checksum/crdref-gen
.task/checksum/crdref-gen

# Test coverage
coverage*

crd-helm-wrapper
Loading