[WIP] Add smart workflows for repository management #1
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 Referenced Assets | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| paths: | |
| - '.claude-plugin/**' | |
| - 'assets/**' | |
| - '.github/workflows/validate-assets.yml' | |
| pull_request: | |
| branches: [ main, develop ] | |
| paths: | |
| - '.claude-plugin/**' | |
| - 'assets/**' | |
| - '.github/workflows/validate-assets.yml' | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.9' | |
| - name: Validate assets referenced in plugin.json | |
| run: | | |
| python3 << 'EOF' | |
| import json | |
| import os | |
| import sys | |
| errors = [] | |
| with open('.claude-plugin/plugin.json', 'r') as f: | |
| plugin_data = json.load(f) | |
| # Check icon | |
| if 'icon' in plugin_data: | |
| icon_path = plugin_data['icon'] | |
| if not os.path.exists(icon_path): | |
| errors.append(f"Icon not found: {icon_path}") | |
| else: | |
| print(f"✓ Icon found: {icon_path}") | |
| # Check readme | |
| if 'readme' in plugin_data: | |
| readme_path = plugin_data['readme'] | |
| if not os.path.exists(readme_path): | |
| errors.append(f"README not found: {readme_path}") | |
| else: | |
| print(f"✓ README found: {readme_path}") | |
| if errors: | |
| print("\nErrors found:") | |
| for error in errors: | |
| print(f" - {error}") | |
| sys.exit(1) | |
| print("\n✓ All assets referenced in plugin.json exist") | |
| EOF | |
| - name: Validate assets referenced in marketplace.json | |
| run: | | |
| python3 << 'EOF' | |
| import json | |
| import os | |
| import sys | |
| errors = [] | |
| with open('.claude-plugin/marketplace.json', 'r') as f: | |
| marketplace_data = json.load(f) | |
| # Check icon | |
| if 'icon' in marketplace_data: | |
| icon_path = marketplace_data['icon'] | |
| if not os.path.exists(icon_path): | |
| errors.append(f"Icon not found: {icon_path}") | |
| else: | |
| print(f"✓ Icon found: {icon_path}") | |
| # Check screenshots | |
| if 'screenshots' in marketplace_data: | |
| for screenshot in marketplace_data['screenshots']: | |
| if not os.path.exists(screenshot): | |
| errors.append(f"Screenshot not found: {screenshot}") | |
| else: | |
| print(f"✓ Screenshot found: {screenshot}") | |
| if errors: | |
| print("\nErrors found:") | |
| for error in errors: | |
| print(f" - {error}") | |
| sys.exit(1) | |
| print("\n✓ All assets referenced in marketplace.json exist") | |
| EOF |