Skip to content

Commit d0fa7fb

Browse files
committed
Initial commit: plugin marketplace structure, template, CI/CD, and docs
0 parents  commit d0fa7fb

18 files changed

Lines changed: 1721 additions & 0 deletions
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Rebuild Index
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'plugins/**'
8+
9+
jobs:
10+
rebuild:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.13'
20+
21+
- name: Rebuild index.json
22+
run: python scripts/build_index.py
23+
24+
- name: Check for changes
25+
id: check
26+
run: |
27+
git diff --quiet index.json || echo "changed=true" >> $GITHUB_OUTPUT
28+
29+
- name: Commit updated index
30+
if: steps.check.outputs.changed == 'true'
31+
run: |
32+
git config user.name "github-actions[bot]"
33+
git config user.email "github-actions[bot]@users.noreply.github.com"
34+
git add index.json
35+
git commit -m "chore: rebuild index.json [skip ci]"
36+
git push

.github/workflows/validate-pr.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Validate Plugin PR
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- 'plugins/**'
8+
9+
jobs:
10+
validate:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.13'
20+
21+
- name: Detect changed plugins
22+
id: changed
23+
run: |
24+
# Get list of changed plugin directories
25+
CHANGED=$(git diff --name-only origin/main...HEAD | grep '^plugins/' | cut -d'/' -f1-2 | sort -u)
26+
echo "plugins<<EOF" >> $GITHUB_OUTPUT
27+
echo "$CHANGED" >> $GITHUB_OUTPUT
28+
echo "EOF" >> $GITHUB_OUTPUT
29+
echo "Changed plugins: $CHANGED"
30+
31+
- name: Validate each changed plugin
32+
run: |
33+
FAILED=0
34+
while IFS= read -r plugin_path; do
35+
if [ -z "$plugin_path" ] || [ ! -d "$plugin_path" ]; then
36+
continue
37+
fi
38+
echo ""
39+
echo "=========================================="
40+
echo "Validating: $plugin_path"
41+
echo "=========================================="
42+
43+
# Run validation script
44+
python scripts/validate_plugin.py "$plugin_path" || FAILED=1
45+
46+
# Check dependencies
47+
python scripts/check_core_deps.py "$plugin_path" || FAILED=1
48+
49+
# Run plugin tests if they exist
50+
if [ -d "$plugin_path/tests" ]; then
51+
echo "Running plugin tests..."
52+
cd "$plugin_path"
53+
python -m pytest tests/ -v || FAILED=1
54+
cd -
55+
fi
56+
57+
done <<< "${{ steps.changed.outputs.plugins }}"
58+
59+
if [ $FAILED -ne 0 ]; then
60+
echo ""
61+
echo "❌ Validation failed for one or more plugins"
62+
exit 1
63+
fi
64+
echo ""
65+
echo "✅ All plugins validated successfully"
66+
67+
- name: Post results to PR
68+
if: always()
69+
uses: actions/github-script@v7
70+
with:
71+
script: |
72+
const { data: comments } = await github.rest.issues.listComments({
73+
owner: context.repo.owner,
74+
repo: context.repo.repo,
75+
issue_number: context.issue.number,
76+
});
77+
78+
const botComment = comments.find(c =>
79+
c.user.type === 'Bot' && c.body.includes('Plugin Validation')
80+
);
81+
82+
const status = '${{ job.status }}' === 'success' ? '✅' : '❌';
83+
const body = `## ${status} Plugin Validation
84+
85+
**Status**: ${{ job.status }}
86+
87+
The following checks were run:
88+
- Plugin manifest validation
89+
- Security scan (no eval/exec/subprocess/os.system)
90+
- Core import guard
91+
- Dependency conflict check
92+
- Plugin tests (if present)
93+
94+
See the [Actions log](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.`;
95+
96+
if (botComment) {
97+
await github.rest.issues.updateComment({
98+
owner: context.repo.owner,
99+
repo: context.repo.repo,
100+
comment_id: botComment.id,
101+
body,
102+
});
103+
} else {
104+
await github.rest.issues.createComment({
105+
owner: context.repo.owner,
106+
repo: context.repo.repo,
107+
issue_number: context.issue.number,
108+
body,
109+
});
110+
}

0 commit comments

Comments
 (0)