diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3c9fa0b2..b3ad5c96 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,12 +6,35 @@ on: pull_request: jobs: lint: + if: github.event.pull_request.head.repo.fork == false || github.event_name == 'push' runs-on: buildjet-4vcpu-ubuntu-2204 container: image: node:20 credentials: - username: "${{ vars.DOCKER_HUB_USERNAME }}" - password: "${{ secrets.DOCKER_HUB_API_KEY }}" + username: ${{ vars.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_API_KEY }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: pnpm setup + uses: pnpm/action-setup@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + - name: Install packages + run: pnpm install + - name: Run Lint + run: pnpm lint + env: + SKIP_ENV_VALIDATION: true + + lint-forks: + if: github.event.pull_request.head.repo.fork == true + runs-on: buildjet-4vcpu-ubuntu-2204 + container: + image: node:20 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/pin-dependencies-check.yml b/.github/workflows/pin-dependencies-check.yml index 2f6d3b0e..3925eb55 100644 --- a/.github/workflows/pin-dependencies-check.yml +++ b/.github/workflows/pin-dependencies-check.yml @@ -6,6 +6,7 @@ on: pull_request: jobs: pin-dependencies-check: + if: github.event.pull_request.head.repo.fork == false || github.event_name == 'push' runs-on: buildjet-4vcpu-ubuntu-2204 container: image: node:20 @@ -45,3 +46,42 @@ jobs: console.log("All dependencies are pinned."); } ' + + pin-dependencies-check-forks: + if: github.event.pull_request.head.repo.fork == true + runs-on: buildjet-4vcpu-ubuntu-2204 + container: + image: node:20 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Check for pinned dependencies + run: | + node -e ' + const fs = require("fs"); + const pkg = JSON.parse(fs.readFileSync("package.json", "utf8")); + const errors = []; + + function isPinned(version) { + return /^\d+\.\d+\.\d+(-canary\.\d+)?$/.test(version); + } + + for (const [dep, version] of Object.entries(pkg.dependencies || {})) { + if (!isPinned(version)) { + errors.push(`Dependency "${dep}" is not pinned: "${version}"`); + } + } + + for (const [dep, version] of Object.entries(pkg.devDependencies || {})) { + if (!isPinned(version)) { + errors.push(`Dev dependency "${dep}" is not pinned: "${version}"`); + } + } + + if (errors.length > 0) { + console.error(`\n${errors.join("\n")}\n`); + process.exit(1); + } else { + console.log("All dependencies are pinned."); + } + ' diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml index 9db5c2f1..604b27b8 100644 --- a/.github/workflows/pr-title-check.yml +++ b/.github/workflows/pr-title-check.yml @@ -4,6 +4,7 @@ on: types: [opened, edited, synchronize] jobs: pr-title-check: + if: github.event.pull_request.head.repo.fork == false runs-on: buildjet-4vcpu-ubuntu-2204 container: image: node:20 @@ -16,3 +17,15 @@ jobs: - name: Run PR title check run: | node .github/scripts/pr-title-check.js + + pr-title-check-forks: + if: github.event.pull_request.head.repo.fork == true + runs-on: buildjet-4vcpu-ubuntu-2204 + container: + image: node:20 + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Run PR title check + run: | + node .github/scripts/pr-title-check.js diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 926d4511..7a9bf287 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,6 +6,7 @@ on: pull_request: jobs: tests: + if: github.event.pull_request.head.repo.fork == false || github.event_name == 'push' runs-on: buildjet-4vcpu-ubuntu-2204 container: image: node:20 @@ -30,3 +31,27 @@ jobs: run: pnpm test env: SKIP_ENV_VALIDATION: true + + tests-forks: + if: github.event.pull_request.head.repo.fork == true + runs-on: buildjet-4vcpu-ubuntu-2204 + container: + image: node:20 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: pnpm setup + uses: pnpm/action-setup@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + - name: Install Doppler CLI + uses: dopplerhq/cli-action@v3 + - name: Install packages + run: pnpm install + - name: Run Tests + run: pnpm test + env: + SKIP_ENV_VALIDATION: true diff --git a/package.json b/package.json index 574b37a2..c2824a10 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "resend", + "name": "gabrielmfern-resend", "version": "6.0.1", "description": "Node.js library for the Resend API", "main": "./dist/index.js",