Temp merge pr16 #5
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: Branch Protection | |
| on: | |
| pull_request: | |
| branches: [main] | |
| types: [opened, synchronize] | |
| jobs: | |
| validate-pr: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20.x" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| - name: Build project | |
| run: npm run build | |
| - name: Check PR size | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const pr = context.payload.pull_request; | |
| const additions = pr.additions; | |
| const changedFiles = pr.changed_files; | |
| console.log(`PR Stats: +${additions} files: ${changedFiles}`); | |
| // Warn about very large PRs | |
| if (additions > 2000 || changedFiles > 50) { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: pr.number, | |
| body: `⚠️ **Large PR Detected** - ${additions} additions across ${changedFiles} files. Consider breaking into smaller PRs for easier review.` | |
| }); | |
| } |