refactor: rename skills and prompts with copilot- prefix for clarity #4
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 Customizations | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - ".github/agents/**" | |
| - ".github/prompts/**" | |
| - ".github/skills/**" | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - ".github/agents/**" | |
| - ".github/prompts/**" | |
| - ".github/skills/**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| pip install pyyaml | |
| - name: Validate Agent Files | |
| id: validate_agents | |
| run: | | |
| echo "## 🤖 Agent Validation" >> $GITHUB_STEP_SUMMARY | |
| ERROR_COUNT=0 | |
| if [ -d ".github/agents" ]; then | |
| AGENTS=$(find .github/agents -name "*.agent.md" | sort) | |
| if [ -z "$AGENTS" ]; then | |
| echo "✅ No agent files found" >> $GITHUB_STEP_SUMMARY | |
| else | |
| for file in $AGENTS; do | |
| echo "Checking: $file" | |
| # Check if file has YAML frontmatter | |
| if ! head -1 "$file" | grep -q "^---$"; then | |
| echo "❌ Missing YAML frontmatter: $file" >> $GITHUB_STEP_SUMMARY | |
| ERROR_COUNT=$((ERROR_COUNT + 1)) | |
| else | |
| echo "✅ Valid structure: $file" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| # Check for required fields (name, description) | |
| if ! grep -q "^name:" "$file"; then | |
| echo "⚠️ Missing 'name' field: $file" >> $GITHUB_STEP_SUMMARY | |
| ERROR_COUNT=$((ERROR_COUNT + 1)) | |
| fi | |
| if ! grep -q "^description:" "$file"; then | |
| echo "⚠️ Missing 'description' field: $file" >> $GITHUB_STEP_SUMMARY | |
| ERROR_COUNT=$((ERROR_COUNT + 1)) | |
| fi | |
| done | |
| fi | |
| else | |
| echo "ℹ️ No agents directory found" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "error_count_agents=$ERROR_COUNT" >> $GITHUB_OUTPUT | |
| - name: Validate Prompt Files | |
| id: validate_prompts | |
| run: | | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "## 📝 Prompt Validation" >> $GITHUB_STEP_SUMMARY | |
| ERROR_COUNT=0 | |
| if [ -d ".github/prompts" ]; then | |
| PROMPTS=$(find .github/prompts -name "*.prompt.md" | sort) | |
| if [ -z "$PROMPTS" ]; then | |
| echo "✅ No prompt files found" >> $GITHUB_STEP_SUMMARY | |
| else | |
| for file in $PROMPTS; do | |
| echo "Checking: $file" | |
| # Check if file has YAML frontmatter | |
| if ! head -1 "$file" | grep -q "^---$"; then | |
| echo "❌ Missing YAML frontmatter: $file" >> $GITHUB_STEP_SUMMARY | |
| ERROR_COUNT=$((ERROR_COUNT + 1)) | |
| else | |
| echo "✅ Valid structure: $file" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| # Check for required fields | |
| if ! grep -q "^name:" "$file"; then | |
| echo "⚠️ Missing 'name' field: $file" >> $GITHUB_STEP_SUMMARY | |
| ERROR_COUNT=$((ERROR_COUNT + 1)) | |
| fi | |
| if ! grep -q "^description:" "$file"; then | |
| echo "⚠️ Missing 'description' field: $file" >> $GITHUB_STEP_SUMMARY | |
| ERROR_COUNT=$((ERROR_COUNT + 1)) | |
| fi | |
| done | |
| fi | |
| else | |
| echo "ℹ️ No prompts directory found" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "error_count_prompts=$ERROR_COUNT" >> $GITHUB_OUTPUT | |
| - name: Validate Skill Files | |
| id: validate_skills | |
| run: | | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "## 🎯 Skill Validation" >> $GITHUB_STEP_SUMMARY | |
| ERROR_COUNT=0 | |
| if [ -d ".github/skills" ]; then | |
| SKILLS=$(find .github/skills -name "SKILL.md" | sort) | |
| if [ -z "$SKILLS" ]; then | |
| echo "✅ No skill files found" >> $GITHUB_STEP_SUMMARY | |
| else | |
| for file in $SKILLS; do | |
| echo "Checking: $file" | |
| # Check for required sections | |
| HAS_NAME=false | |
| HAS_DESC=false | |
| HAS_USAGE=false | |
| if grep -q "^## Name" "$file" || grep -q "^# " "$file"; then | |
| HAS_NAME=true | |
| fi | |
| if grep -q -i "description" "$file"; then | |
| HAS_DESC=true | |
| fi | |
| if grep -q -i "usage\|how to use\|example" "$file"; then | |
| HAS_USAGE=true | |
| fi | |
| if [ "$HAS_NAME" = true ] && [ "$HAS_DESC" = true ] && [ "$HAS_USAGE" = true ]; then | |
| echo "✅ Valid structure: $file" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "⚠️ Incomplete structure: $file" >> $GITHUB_STEP_SUMMARY | |
| [ "$HAS_NAME" = false ] && echo " - Missing name/title" >> $GITHUB_STEP_SUMMARY | |
| [ "$HAS_DESC" = false ] && echo " - Missing description" >> $GITHUB_STEP_SUMMARY | |
| [ "$HAS_USAGE" = false ] && echo " - Missing usage/examples" >> $GITHUB_STEP_SUMMARY | |
| ERROR_COUNT=$((ERROR_COUNT + 1)) | |
| fi | |
| done | |
| fi | |
| else | |
| echo "ℹ️ No skills directory found" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "error_count_skills=$ERROR_COUNT" >> $GITHUB_OUTPUT | |
| - name: Check for Broken Links | |
| run: | | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "## 🔗 Link Validation" >> $GITHUB_STEP_SUMMARY | |
| # Find all markdown files in customization directories | |
| FILES=$(find .github/agents .github/prompts .github/skills -name "*.md" 2>/dev/null || true) | |
| if [ -z "$FILES" ]; then | |
| echo "ℹ️ No markdown files to check" >> $GITHUB_STEP_SUMMARY | |
| else | |
| BROKEN_LINKS=0 | |
| for file in $FILES; do | |
| # Extract relative links (not starting with http) | |
| LINKS=$(grep -oP '\[.*?\]\(\K[^)]+(?=\))' "$file" 2>/dev/null | grep -v "^http" || true) | |
| for link in $LINKS; do | |
| # Remove anchor | |
| LINK_PATH=$(echo "$link" | cut -d'#' -f1) | |
| # Skip empty paths (anchor-only links) | |
| if [ -z "$LINK_PATH" ]; then | |
| continue | |
| fi | |
| # Resolve relative path | |
| DIR=$(dirname "$file") | |
| FULL_PATH="$DIR/$LINK_PATH" | |
| if [ ! -e "$FULL_PATH" ]; then | |
| echo "❌ Broken link in $file: $link" >> $GITHUB_STEP_SUMMARY | |
| BROKEN_LINKS=$((BROKEN_LINKS + 1)) | |
| fi | |
| done | |
| done | |
| if [ $BROKEN_LINKS -eq 0 ]; then | |
| echo "✅ No broken links found" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "⚠️ Found $BROKEN_LINKS broken link(s)" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| fi | |
| - name: Summary | |
| run: | | |
| TOTAL_ERRORS=$(( | |
| ${{ steps.validate_agents.outputs.error_count_agents }} + | |
| ${{ steps.validate_prompts.outputs.error_count_prompts }} + | |
| ${{ steps.validate_skills.outputs.error_count_skills }} | |
| )) | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "---" >> $GITHUB_STEP_SUMMARY | |
| if [ $TOTAL_ERRORS -eq 0 ]; then | |
| echo "### ✅ All validations passed!" >> $GITHUB_STEP_SUMMARY | |
| exit 0 | |
| else | |
| echo "### ⚠️ Found $TOTAL_ERRORS issue(s)" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Please review and fix the issues listed above." >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| fi |