ci: Split PR checks and PR manager workflows
| @@ -12,82 +12,6 @@ permissions: | ||
| 12 | 12 | pull-requests: write |
| 13 | 13 | |
| 14 | 14 | jobs: |
| 15 | - run-eslint: | |
| 16 | - name: ✅ Check ESLint on PR | |
| 17 | - runs-on: ubuntu-latest | |
| 18 | - # Only needs to run when code is changed | |
| 19 | - if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize') | |
| 20 | - | |
| 21 | - # Override permissions, linter likely needs write access to issues | |
| 22 | - permissions: | |
| 23 | - contents: read | |
| 24 | - issues: write | |
| 25 | - pull-requests: write | |
| 26 | - | |
| 27 | - steps: | |
| 28 | - - name: Checkout Repository | |
| 29 | - # Checkout | |
| 30 | - # https://github.com/marketplace/actions/checkout | |
| 31 | - uses: actions/checkout@v4.2.2 | |
| 32 | - with: | |
| 33 | - ref: ${{ github.event.pull_request.head.sha }} | |
| 34 | - repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| 35 | - | |
| 36 | - - name: Setup Node.js | |
| 37 | - # Setup Node.js environment | |
| 38 | - # https://github.com/marketplace/actions/setup-node-js-environment | |
| 39 | - uses: actions/setup-node@v4.3.0 | |
| 40 | - with: | |
| 41 | - node-version: 20 | |
| 42 | - | |
| 43 | - - name: Run npm install | |
| 44 | - run: npm ci | |
| 45 | - | |
| 46 | - - name: Run ESLint | |
| 47 | - # Action ESLint | |
| 48 | - # https://github.com/marketplace/actions/action-eslint | |
| 49 | - uses: sibiraj-s/action-eslint@v3.0.1 | |
| 50 | - with: | |
| 51 | - token: ${{ secrets.GITHUB_TOKEN }} # ESLint can run with the original permissions | |
| 52 | - eslint-args: '--ignore-path=.gitignore --quiet' | |
| 53 | - extensions: 'js' | |
| 54 | - annotations: true | |
| 55 | - ignore-patterns: | | |
| 56 | - dist/ | |
| 57 | - lib/ | |
| 58 | - | |
| 59 | - run-tests: | |
| 60 | - name: ✅ Run Unit Tests on PR | |
| 61 | - runs-on: ubuntu-latest | |
| 62 | - # Only needs to run when code is changed | |
| 63 | - if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize') | |
| 64 | - | |
| 65 | - steps: | |
| 66 | - - name: Checkout Repository | |
| 67 | - # Checkout | |
| 68 | - # https://github.com/marketplace/actions/checkout | |
| 69 | - uses: actions/checkout@v4.2.2 | |
| 70 | - with: | |
| 71 | - ref: ${{ github.event.pull_request.head.sha }} | |
| 72 | - repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| 73 | - | |
| 74 | - - name: Setup Node.js | |
| 75 | - # Setup Node.js environment | |
| 76 | - # https://github.com/marketplace/actions/setup-node-js-environment | |
| 77 | - uses: actions/setup-node@v4.3.0 | |
| 78 | - with: | |
| 79 | - node-version: 20 | |
| 80 | - cache: 'npm' | |
| 81 | - | |
| 82 | - - name: Install root dependencies | |
| 83 | - run: npm ci | |
| 84 | - | |
| 85 | - - name: Install test dependencies | |
| 86 | - run: npm ci --prefix tests | |
| 87 | - | |
| 88 | - - name: Run unit tests | |
| 89 | - run: npm run test:unit --prefix tests | |
| 90 | - | |
| 91 | 15 | label-by-size: |
| 92 | 16 | name: 🏷️ Label PR by Size |
| 93 | 17 | # This job should run after all others, to prevent possible concurrency issues |
| @@ -0,0 +1,84 @@ | ||
| 1 | +name: ✅ Pull Request Checks | |
| 2 | + | |
| 3 | +on: | |
| 4 | + pull_request: | |
| 5 | + types: [opened, synchronize, reopened] | |
| 6 | + | |
| 7 | +permissions: | |
| 8 | + contents: read | |
| 9 | + | |
| 10 | +jobs: | |
| 11 | + run-eslint: | |
| 12 | + name: ✅ Check ESLint on PR | |
| 13 | + runs-on: ubuntu-latest | |
| 14 | + # Only needs to run when code is changed | |
| 15 | + if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize') | |
| 16 | + | |
| 17 | + # Override permissions, linter likely needs write access to issues | |
| 18 | + permissions: | |
| 19 | + contents: read | |
| 20 | + issues: write | |
| 21 | + pull-requests: write | |
| 22 | + | |
| 23 | + steps: | |
| 24 | + - name: Checkout Repository | |
| 25 | + # Checkout | |
| 26 | + # https://github.com/marketplace/actions/checkout | |
| 27 | + uses: actions/checkout@v4.2.2 | |
| 28 | + with: | |
| 29 | + ref: ${{ github.event.pull_request.head.sha }} | |
| 30 | + repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| 31 | + | |
| 32 | + - name: Setup Node.js | |
| 33 | + # Setup Node.js environment | |
| 34 | + # https://github.com/marketplace/actions/setup-node-js-environment | |
| 35 | + uses: actions/setup-node@v4.3.0 | |
| 36 | + with: | |
| 37 | + node-version: 20 | |
| 38 | + | |
| 39 | + - name: Run npm install | |
| 40 | + run: npm ci | |
| 41 | + | |
| 42 | + - name: Run ESLint | |
| 43 | + # Action ESLint | |
| 44 | + # https://github.com/marketplace/actions/action-eslint | |
| 45 | + uses: sibiraj-s/action-eslint@v3.0.1 | |
| 46 | + with: | |
| 47 | + token: ${{ secrets.GITHUB_TOKEN }} # ESLint can run with the original permissions | |
| 48 | + eslint-args: '--ignore-path=.gitignore --quiet' | |
| 49 | + extensions: 'js' | |
| 50 | + annotations: true | |
| 51 | + ignore-patterns: | | |
| 52 | + dist/ | |
| 53 | + lib/ | |
| 54 | + | |
| 55 | + run-tests: | |
| 56 | + name: ✅ Run Unit Tests on PR | |
| 57 | + runs-on: ubuntu-latest | |
| 58 | + # Only needs to run when code is changed | |
| 59 | + if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize') | |
| 60 | + | |
| 61 | + steps: | |
| 62 | + - name: Checkout Repository | |
| 63 | + # Checkout | |
| 64 | + # https://github.com/marketplace/actions/checkout | |
| 65 | + uses: actions/checkout@v4.2.2 | |
| 66 | + with: | |
| 67 | + ref: ${{ github.event.pull_request.head.sha }} | |
| 68 | + repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| 69 | + | |
| 70 | + - name: Setup Node.js | |
| 71 | + # Setup Node.js environment | |
| 72 | + # https://github.com/marketplace/actions/setup-node-js-environment | |
| 73 | + uses: actions/setup-node@v4.3.0 | |
| 74 | + with: | |
| 75 | + node-version: 20 | |
| 76 | + | |
| 77 | + - name: Install root dependencies | |
| 78 | + run: npm ci | |
| 79 | + | |
| 80 | + - name: Install test dependencies | |
| 81 | + run: npm ci --prefix tests | |
| 82 | + | |
| 83 | + - name: Run unit tests | |
| 84 | + run: npm run test:unit --prefix tests | |