diff --git a/.github/workflows/pr-auto-manager.yml b/.github/workflows/pr-auto-manager.yml index 1b35d7d75..0e83dad7f 100644 --- a/.github/workflows/pr-auto-manager.yml +++ b/.github/workflows/pr-auto-manager.yml @@ -12,82 +12,6 @@ permissions: pull-requests: write jobs: - run-eslint: - name: ✅ Check ESLint on PR - runs-on: ubuntu-latest - # Only needs to run when code is changed - if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize') - - # Override permissions, linter likely needs write access to issues - permissions: - contents: read - issues: write - pull-requests: write - - steps: - - name: Checkout Repository - # Checkout - # https://github.com/marketplace/actions/checkout - uses: actions/checkout@v4.2.2 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - - name: Setup Node.js - # Setup Node.js environment - # https://github.com/marketplace/actions/setup-node-js-environment - uses: actions/setup-node@v4.3.0 - with: - node-version: 20 - - - name: Run npm install - run: npm ci - - - name: Run ESLint - # Action ESLint - # https://github.com/marketplace/actions/action-eslint - uses: sibiraj-s/action-eslint@v3.0.1 - with: - token: ${{ secrets.GITHUB_TOKEN }} # ESLint can run with the original permissions - eslint-args: '--ignore-path=.gitignore --quiet' - extensions: 'js' - annotations: true - ignore-patterns: | - dist/ - lib/ - - run-tests: - name: ✅ Run Unit Tests on PR - runs-on: ubuntu-latest - # Only needs to run when code is changed - if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize') - - steps: - - name: Checkout Repository - # Checkout - # https://github.com/marketplace/actions/checkout - uses: actions/checkout@v4.2.2 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - - name: Setup Node.js - # Setup Node.js environment - # https://github.com/marketplace/actions/setup-node-js-environment - uses: actions/setup-node@v4.3.0 - with: - node-version: 20 - cache: 'npm' - - - name: Install root dependencies - run: npm ci - - - name: Install test dependencies - run: npm ci --prefix tests - - - name: Run unit tests - run: npm run test:unit --prefix tests - label-by-size: name: 🏷️ Label PR by Size # This job should run after all others, to prevent possible concurrency issues diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 000000000..03776cfc3 --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,84 @@ +name: ✅ Pull Request Checks + +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + +jobs: + run-eslint: + name: ✅ Check ESLint on PR + runs-on: ubuntu-latest + # Only needs to run when code is changed + if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize') + + # Override permissions, linter likely needs write access to issues + permissions: + contents: read + issues: write + pull-requests: write + + steps: + - name: Checkout Repository + # Checkout + # https://github.com/marketplace/actions/checkout + uses: actions/checkout@v4.2.2 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + + - name: Setup Node.js + # Setup Node.js environment + # https://github.com/marketplace/actions/setup-node-js-environment + uses: actions/setup-node@v4.3.0 + with: + node-version: 20 + + - name: Run npm install + run: npm ci + + - name: Run ESLint + # Action ESLint + # https://github.com/marketplace/actions/action-eslint + uses: sibiraj-s/action-eslint@v3.0.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} # ESLint can run with the original permissions + eslint-args: '--ignore-path=.gitignore --quiet' + extensions: 'js' + annotations: true + ignore-patterns: | + dist/ + lib/ + + run-tests: + name: ✅ Run Unit Tests on PR + runs-on: ubuntu-latest + # Only needs to run when code is changed + if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize') + + steps: + - name: Checkout Repository + # Checkout + # https://github.com/marketplace/actions/checkout + uses: actions/checkout@v4.2.2 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + + - name: Setup Node.js + # Setup Node.js environment + # https://github.com/marketplace/actions/setup-node-js-environment + uses: actions/setup-node@v4.3.0 + with: + node-version: 20 + + - name: Install root dependencies + run: npm ci + + - name: Install test dependencies + run: npm ci --prefix tests + + - name: Run unit tests + run: npm run test:unit --prefix tests