Add LICENSE infos #3
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: PR Assistant | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, closed] | |
| push: | |
| branches: [main, master] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| checks: write | |
| issues: write | |
| env: | |
| MAIN_REPO: "faneX-ID/core" | |
| MAIN_BRANCH: "main" | |
| jobs: | |
| pr-validation: | |
| if: github.event_name == 'pull_request' && github.event.action != 'closed' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Install Dependencies | |
| run: | | |
| pip install jsonschema requests | |
| - name: 📥 Fetch Version Info from faneX-ID Main Repository | |
| id: versions | |
| run: | | |
| python << 'EOF' | |
| import json | |
| import requests | |
| import os | |
| main_repo = 'faneX-ID/faneX-ID' | |
| main_branch = os.environ.get('MAIN_BRANCH', 'main') | |
| versions_url = f"https://raw.githubusercontent.com/{main_repo}/{main_branch}/.github/versions.json" | |
| try: | |
| response = requests.get(versions_url, timeout=10) | |
| response.raise_for_status() | |
| versions = response.json() | |
| with open(os.environ['GITHUB_OUTPUT'], 'a') as f: | |
| f.write(f"workflow_schema_version={versions.get('workflow_schema_version', '2.0.0')}\n") | |
| print(f"✅ Fetched versions from {main_repo}") | |
| except Exception as e: | |
| print(f"⚠️ Could not fetch versions: {e}, using fallback") | |
| with open(os.environ['GITHUB_OUTPUT'], 'a') as f: | |
| f.write("workflow_schema_version=2.0.0\n") | |
| EOF | |
| - name: 📝 Validate Workflow Manifests | |
| run: | | |
| python << 'EOF' | |
| import json | |
| import sys | |
| from pathlib import Path | |
| import requests | |
| import jsonschema | |
| schema_url = "https://raw.githubusercontent.com/faneX-ID/core/main/docs/specs/integrations-manifest/schemas/workflow-manifest.json" | |
| try: | |
| response = requests.get(schema_url, timeout=10) | |
| response.raise_for_status() | |
| schema = json.loads(response.text) | |
| except Exception as e: | |
| print(f"⚠️ Could not fetch schema: {e}") | |
| sys.exit(1) | |
| errors = [] | |
| for manifest_path in Path(".").glob("*/manifest.json"): | |
| workflow_name = manifest_path.parent.name | |
| try: | |
| with open(manifest_path) as f: | |
| manifest = json.load(f) | |
| jsonschema.validate(instance=manifest, schema=schema) | |
| print(f"✅ {workflow_name} valid") | |
| except jsonschema.ValidationError as e: | |
| errors.append(f"{workflow_name}: {e.message}") | |
| if errors: | |
| print("\n❌ Errors found:") | |
| for e in errors: | |
| print(f" - {e}") | |
| sys.exit(1) | |
| EOF | |
| - name: Feedback Comment | |
| if: always() | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const outcome = '${{ job.status }}'; | |
| if (outcome === 'failure') { | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: "❌ **PR Validation Failed**\n\nPlease check the validation errors above." | |
| }); | |
| } else if (outcome === 'success') { | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: "✅ **PR Validation Passed**\n\nAll checks passed successfully!" | |
| }); | |
| } | |
| thank-you: | |
| if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const author = context.payload.pull_request.user.login; | |
| const admins = ['FaserF', 'fabia', 'github-actions[bot]']; | |
| if (admins.includes(author)) return; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `🎉 **Thank you @${author}!**\n\nYour contribution to the **faneX-ID Workflows Example** repository is valuable! 🚀` | |
| }); |