diff --git a/.DS_Store b/.DS_Store index b7f6d30..cdf4d7a 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.github/workflows/prnote.yml b/.github/workflows/prnote.yml new file mode 100644 index 0000000..6cc76d3 --- /dev/null +++ b/.github/workflows/prnote.yml @@ -0,0 +1,18 @@ +name: PRNote + +on: + pull_request: + types: [opened] + +permissions: + contents: read + pull-requests: write + +jobs: + generate-pr-note: + runs-on: ubuntu-latest + steps: + - name: Generate PR title and description + uses: richardj46/prnote-action@v0.1.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index fca1777..54cbfb7 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,10 @@ Requires Node.js 20 or newer. ```sh cp .env.example .env npm install -set -a; source .env; set +a npm run dev ``` -GitHub must be able to reach the webhook URL, so expose port 3000 with a trusted tunnel for local development. The app intentionally does not load `.env` itself; production secrets should come from the hosting platform. +GitHub must be able to reach the webhook URL, so expose port 3000 with a trusted tunnel for local development. The app automatically loads `.env` from its working directory. Variables already provided by the hosting platform take precedence. ## Configuration diff --git a/package.json b/package.json index 34554dc..9a5f4e9 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "format:check": "prettier --check ." }, "engines": { - "node": ">=20" + "node": ">=20.12" }, "dependencies": { "minimatch": "^10.0.1" diff --git a/src/server.ts b/src/server.ts index 63e8994..9f0d798 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,9 +1,17 @@ import { createServer } from "node:http"; +import { loadEnvFile } from "node:process"; import { verifyWebhook } from "./auth.js"; import { readConfig } from "./config.js"; import { processPullRequest } from "./processor.js"; import type { PullRequestOpenedPayload } from "./types.js"; +try { + loadEnvFile(); +} catch (error) { + const code = (error as NodeJS.ErrnoException).code; + if (code !== "ENOENT") throw error; +} + const config = readConfig(); const maxBodyBytes = 25 * 1024 * 1024;