mirror of
https://github.com/MatesMediaDev/JollyRipper-PluginsDirectory.git
synced 2026-05-30 00:11:25 +00:00
Initial plugin directory setup
This commit is contained in:
37
.github/workflows/update-index.yml
vendored
Normal file
37
.github/workflows/update-index.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Update Plugin Index
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- 'plugins/*.json'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
update-index:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
|
||||
- name: Generate index.json
|
||||
run: node .github/scripts/update-index.js
|
||||
|
||||
- name: Commit index.json
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add plugins/index.json
|
||||
if git diff --staged --quiet; then
|
||||
echo "No changes to index.json"
|
||||
else
|
||||
git commit -m "Auto-update plugin index [skip ci]"
|
||||
git push
|
||||
fi
|
||||
93
.github/workflows/validate-pr.yml
vendored
Normal file
93
.github/workflows/validate-pr.yml
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
name: Validate Plugin PR
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout base branch (main) for validation scripts
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
path: base
|
||||
|
||||
- name: Checkout PR branch for plugin files
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: pr
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
run: |
|
||||
cd pr
|
||||
echo "files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '^plugins/' || echo '')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Block attempts to modify infrastructure
|
||||
run: |
|
||||
cd pr
|
||||
INFRA_CHANGES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -E '^\.github/' || echo '')
|
||||
if [ -n "$INFRA_CHANGES" ]; then
|
||||
echo "❌ ERROR: PRs cannot modify .github/ directory files"
|
||||
echo "Changed infrastructure files:"
|
||||
echo "$INFRA_CHANGES"
|
||||
echo ""
|
||||
echo "Only plugins/ directory changes are allowed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Verify commit authors match PR creator
|
||||
run: |
|
||||
cd pr
|
||||
echo "🔍 Verifying commit authors..."
|
||||
PR_USER="${{ github.event.pull_request.user.login }}"
|
||||
echo "PR created by: $PR_USER"
|
||||
|
||||
COMMITS=$(git log --format="%H" origin/${{ github.base_ref }}..HEAD)
|
||||
|
||||
for commit in $COMMITS; do
|
||||
AUTHOR=$(git show -s --format='%an' $commit)
|
||||
EMAIL=$(git show -s --format='%ae' $commit)
|
||||
echo " Commit $commit by $AUTHOR <$EMAIL>"
|
||||
done
|
||||
|
||||
echo "✓ PR created by authenticated user: $PR_USER"
|
||||
echo "Note: Validation will check plugin ownership against this authenticated user, not git commit authors"
|
||||
|
||||
- name: Validate PR (using trusted validation script from main)
|
||||
run: |
|
||||
cd base
|
||||
node .github/scripts/validate-pr.js "${{ github.event.pull_request.user.login }}" "${{ steps.changed-files.outputs.files }}"
|
||||
env:
|
||||
PR_FILES_DIR: ../pr/plugins
|
||||
|
||||
- name: Post approval comment
|
||||
if: success()
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
body: '✅ **Validation passed!** Auto-merging this pull request.\n\nAll plugin requirements have been met:\n- ✓ Valid plugin schema\n- ✓ Correct filename format\n- ✓ Author verification\n- ✓ Repository URL valid\n\nYour plugin will be available in the directory shortly!'
|
||||
});
|
||||
|
||||
- name: Auto-merge PR
|
||||
if: success()
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
cd pr
|
||||
echo "✅ Validation passed - Auto-merging PR"
|
||||
gh pr merge ${{ github.event.pull_request.number }} --squash --auto --repo ${{ github.repository }}
|
||||
Reference in New Issue
Block a user