Files
Plugin-Directory/.gitea/workflows/validate-pr.yml

42 lines
1.3 KiB
YAML

name: Validate Plugin PR
on:
pull_request:
branches: [ main ]
paths:
- 'plugins/**'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Get changed files
id: changed-files
run: |
echo "files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '^plugins/' || echo '')" >> $GITHUB_OUTPUT
- name: Validate PR
run: |
node .gitea/scripts/validate-pr.js "${{ github.event.pull_request.user.login }}" "${{ steps.changed-files.outputs.files }}"
- name: Auto-merge PR
if: success()
run: |
echo "✅ Validation passed - Auto-merging PR"
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git fetch origin ${{ github.event.pull_request.head.ref }}
git checkout main
git merge --squash origin/${{ github.event.pull_request.head.ref }}
git commit -m "${{ github.event.pull_request.title }}"
git push origin main
git push origin --delete ${{ github.event.pull_request.head.ref }}