diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..bf35335 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,54 @@ +name: Build + +env: + NODE_VERSION: "24" + +on: + push: + branches: + - "main" + paths: + - "scripts/**" + - "package.json" + - "package-lock.json" + - "tsconfig.json" + - "biome.json" + - ".github/workflows/build.yml" + pull_request: + paths: + - "scripts/**" + - "package.json" + - "package-lock.json" + - "tsconfig.json" + - "biome.json" + - ".github/workflows/build.yml" + workflow_dispatch: + +permissions: + contents: read + +jobs: + lint: + name: Lint & Format + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v7 + with: + node-version: ${{ env.NODE_VERSION }} + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Run Biome check + run: npm run check + + - name: Check TypeScript + run: npm run typecheck diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index 0536b19..e682e22 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -1,12 +1,25 @@ name: Labels +env: + NODE_VERSION: "24" + # Brings the shared labels in labels.yml to every public repository: creates # the missing ones and corrects colour and description. Labels a repository # keeps for its own areas are never touched or deleted. on: push: - branches: [main] - paths: [labels.yml, scripts/labels-sync.mjs] + branches: + - "main" + paths: + - "labels.yml" + - "scripts/labels-sync.ts" + - "scripts/github.ts" + - "package.json" + - "package-lock.json" + - ".github/workflows/labels.yml" + schedule: + # Daily, so a newly created repository gets the labels without a push. + - cron: "0 6 * * *" workflow_dispatch: permissions: @@ -14,23 +27,35 @@ permissions: jobs: sync: + name: Sync labels runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false - - uses: actions/setup-node@v4 + - name: Setup Node.js + uses: actions/setup-node@v7 with: - node-version: 24 + node-version: ${{ env.NODE_VERSION }} + cache: "npm" + + - name: Install dependencies + run: npm ci --omit=dev - - id: app - uses: actions/create-github-app-token@v2 + - name: Create app token + id: app + uses: actions/create-github-app-token@v3 with: - app-id: ${{ vars.PROJECT_APP_ID }} + # nvisy-bot. A client ID is public; only the private key is a secret. + client-id: Iv23li4OFiUQmJcoK9mo private-key: ${{ secrets.PROJECT_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} - - run: node scripts/labels-sync.mjs + - name: Sync labels + run: node scripts/labels-sync.ts env: GH_TOKEN: ${{ steps.app.outputs.token }} ORG: ${{ github.repository_owner }} diff --git a/.github/workflows/project-sync.yml b/.github/workflows/project-sync.yml index a10b4bb..a68d595 100644 --- a/.github/workflows/project-sync.yml +++ b/.github/workflows/project-sync.yml @@ -1,7 +1,12 @@ name: Project sync +env: + NODE_VERSION: "24" + # Adds every open issue and human pull request in the organization's public -# repositories to the "Nvisy OSS" project. Safe to run any number of times. +# repositories that is not yet on the "Nvisy OSS" project. GitHub runs +# schedules late and drops some under load, so the cron is a ceiling on +# frequency, not a promise: new items can take a few hours to appear. on: schedule: - cron: "*/15 * * * *" @@ -21,25 +26,37 @@ concurrency: jobs: sync: + name: Sync project runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false - - uses: actions/setup-node@v4 + - name: Setup Node.js + uses: actions/setup-node@v7 with: - node-version: 24 + node-version: ${{ env.NODE_VERSION }} + cache: "npm" + + - name: Install dependencies + run: npm ci --omit=dev # The default GITHUB_TOKEN cannot write to organization projects, so the - # sync runs as the organization's project app. - - id: app - uses: actions/create-github-app-token@v2 + # sync runs as the organization's nvisy-bot app. + - name: Create app token + id: app + uses: actions/create-github-app-token@v3 with: - app-id: ${{ vars.PROJECT_APP_ID }} + # nvisy-bot. A client ID is public; only the private key is a secret. + client-id: Iv23li4OFiUQmJcoK9mo private-key: ${{ secrets.PROJECT_APP_PRIVATE_KEY }} owner: ${{ github.repository_owner }} - - run: node scripts/project-sync.mjs + - name: Sync project + run: node scripts/project-sync.ts env: GH_TOKEN: ${{ steps.app.outputs.token }} ORG: ${{ github.repository_owner }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2752eb9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +.DS_Store diff --git a/README.md b/README.md index 9ca1b76..3d11b73 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,26 @@ Organization-wide defaults and automation for Nvisy's open-source repositories. - **Issue forms and pull request template** (`.github/`): used by every repository that has none of its own. The forms set the organization's issue types (Bug, Feature, Task). -- **Project sync** (`scripts/project-sync.mjs`, every 15 minutes): adds every - open issue and human pull request in a public repository to the - [Nvisy OSS](https://github.com/orgs/nvisycom/projects/7) project. Status - after that is kept by the project's built-in workflows. +- **Project sync** (`scripts/project-sync.ts`): adds every open issue and + human pull request in a public repository to the + [Nvisy OSS](https://github.com/orgs/nvisycom/projects/7) project. It runs on + a 15-minute schedule, which GitHub runs late and sometimes hours apart, so a + new item can take a few hours to appear. Status after that is kept by the + project's built-in workflows. - **Labels** (`labels.yml`): the labels every public repository shares, - synced on change. Repositories keep their own area labels alongside. + synced on change and daily. Repositories keep their own area labels alongside. -Both workflows authenticate as the organization's project app: its id in the -`PROJECT_APP_ID` variable and its key in the `PROJECT_APP_PRIVATE_KEY` secret. -Run either script locally with `GH_TOKEN=$(gh auth token)`; set `DRY_RUN=1` on -the project sync to see what it would add. +## Authentication + +Both workflows run as the organization's `nvisy-bot` app. Its client ID is in +the workflows; its private key is this repository's `PROJECT_APP_PRIVATE_KEY` +secret, which never leaves this repository. + +## Development + +The scripts are TypeScript that Node 24 runs directly, so there is no build +step. They talk to GitHub through [Octokit](https://github.com/octokit/octokit.js), +which handles pagination, retries and rate limits (`scripts/github.ts`). +`npm ci` also installs Biome and the type checker for `npm run check` and +`npm run typecheck`. Run either script locally with +`GH_TOKEN=$(gh auth token)`; set `DRY_RUN=1` to see what it would change. diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..dc2d742 --- /dev/null +++ b/biome.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.6.9/schema.json", + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true + }, + "files": { + "ignoreUnknown": false, + "includes": ["**", "!node_modules", "!.claude"] + }, + "formatter": { + "enabled": true, + "indentStyle": "tab" + }, + "assist": { "actions": { "source": { "preset": "recommended" } } }, + "linter": { + "enabled": true, + "rules": { + "preset": "recommended", + "style": { + "preset": "recommended", + "noNonNullAssertion": "off" + } + } + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + } + } +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..c85eb5e --- /dev/null +++ b/package-lock.json @@ -0,0 +1,926 @@ +{ + "name": "@nvisy/github", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@nvisy/github", + "dependencies": { + "octokit": "^5.0.5", + "yaml": "^2.9.1" + }, + "devDependencies": { + "@biomejs/biome": "^2.6.9", + "@types/node": "^26.4.0", + "typescript": "^5.9.3" + }, + "engines": { + "node": ">=24.0.0" + } + }, + "node_modules/@biomejs/biome": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.6.9.tgz", + "integrity": "sha512-RelCBDzTXu4DBU8c35P4iMrDO80SUjW0OgjDA7CT1z3UcCU5IclWTZ2XnMelI4frQL//xg2K2BQxAhcOKxdPQA==", + "dev": true, + "license": "MIT OR Apache-2.0", + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.21.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-android-arm64": "2.6.9", + "@biomejs/cli-android-x64": "2.6.9", + "@biomejs/cli-darwin-arm64": "2.6.9", + "@biomejs/cli-darwin-x64": "2.6.9", + "@biomejs/cli-linux-arm64": "2.6.9", + "@biomejs/cli-linux-arm64-musl": "2.6.9", + "@biomejs/cli-linux-x64": "2.6.9", + "@biomejs/cli-linux-x64-musl": "2.6.9", + "@biomejs/cli-win32-arm64": "2.6.9", + "@biomejs/cli-win32-x64": "2.6.9" + } + }, + "node_modules/@biomejs/cli-android-arm64": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@biomejs/cli-android-arm64/-/cli-android-arm64-2.6.9.tgz", + "integrity": "sha512-/3Aj5aiG+Iz8yDBJJb/GFDsptr9ONk3n1wZUIERuU+pVXMIslBaOnrTYJI5QVVXZ9jE494myQHiIvFrjQCBYeQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-android-x64": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@biomejs/cli-android-x64/-/cli-android-x64-2.6.9.tgz", + "integrity": "sha512-erjbUpD9KJhzTsGHY9oStJ1bSiUJ1ikUXgdr0iOFoIAMiKqW+GdVdEqAlEyqiZA6CBiFqf2fV+g0AVl3hYOuYg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.6.9.tgz", + "integrity": "sha512-fO67s0SF+lKGhNPQ7jUXiz0yXGl/1Qm3XTIn/4Hd2Z2z3ewQMrotWIMVdIPxZAgLJdQtRLBOzgsTRzTl981yWA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.6.9.tgz", + "integrity": "sha512-RdjT3Z6dLlii0x6EroncTp9jg38FMx2R1aeaaU4BbZ4//3TJ2mA2R39KMIrZYxHdHXcfv9X2V5hwKkXhg08w/g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.6.9.tgz", + "integrity": "sha512-x73OpQSuQLuvNfzXWEjf0mK95NxlJQX4eG/jmuSrGWOz+/jcLUE4N/21yBu3n0X+wa8bJ3NsWNvmNacLnyc2CQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.6.9.tgz", + "integrity": "sha512-qoG0R5MhJ8VFozVFZQC42V3qCI1TInDhL/YcPPg0oTzfv3vuh0ZDXj+2nNahq8gboHUMv7MWpGjRDLhpQatJ+A==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.6.9.tgz", + "integrity": "sha512-uVrqS0HDjRzFlx88ZpfmlZvJ+xIwTU+110vunzrYvZQ5OqXl/1ugMTNvAs61hejH7jh7iequKJwagRVarrYcSQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.6.9.tgz", + "integrity": "sha512-o73Sk1hCbGOFOrDlxtpHGIubnLwMXscT32+ujMwUyq9o0f4onxO7OznzkFgcZGbwKy1R3ohroOkqZDXqj1u29g==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.6.9.tgz", + "integrity": "sha512-4yvNG4nQGJsJA/PTVAt8IBFXvY6hXk4UdjtPlTf4QTMIjH7ysOwBew78bKThkRv1eyRwH2mGLIk4lAZp8tfAdw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.6.9.tgz", + "integrity": "sha512-mwarNc4GEg5JknsRaJDyJDFr4kICD7snsGM8yYFOoIHimSU1ekWNbcZ44QDa6/30fUZC9077wbBpXE8fp03aug==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@octokit/app": { + "version": "16.1.4", + "resolved": "https://registry.npmjs.org/@octokit/app/-/app-16.1.4.tgz", + "integrity": "sha512-g70WONQyGoBgqIJtv4O0MUEfOF1iJpTfFt3qAW7HaiwiJ6k607xg/gBezCa4tuq6BpO6qXn7qvq8v9tjWtgGQg==", + "license": "MIT", + "dependencies": { + "@octokit/auth-app": "^8.3.0", + "@octokit/auth-unauthenticated": "^7.0.4", + "@octokit/core": "^7.0.7", + "@octokit/oauth-app": "^8.0.4", + "@octokit/plugin-paginate-rest": "^15.0.0", + "@octokit/types": "^17.0.0", + "@octokit/webhooks": "^14.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/app/node_modules/@octokit/openapi-types": { + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-28.0.0.tgz", + "integrity": "sha512-0rFyLuyHvIj6uuZWuDslxkowFYdPXoNIkeAv4b27dzm2Tf4vGWXnPsMcxs7d65kLdMERgP3wc1AEPlqMz8e1cQ==", + "license": "MIT" + }, + "node_modules/@octokit/app/node_modules/@octokit/plugin-paginate-rest": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-15.0.0.tgz", + "integrity": "sha512-lw9A9YL5s4VPj+VEx8uMxaxQm2YTgrPDkrLEuZuu18R8TK3oPcXF4K6t52nx6xn1RcogZC9i188sAr/4XYJaQQ==", + "license": "MIT", + "dependencies": { + "@octokit/types": "^17.0.0" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=6" + } + }, + "node_modules/@octokit/app/node_modules/@octokit/types": { + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-17.0.0.tgz", + "integrity": "sha512-ByP1v7YL5SMveFPP7+sj0/ZuWCOOg/Chs4NafOMpq6WNIM/hdGY0S7C0TCGDBWu1aGmOxmUIhMx3cO+IdwYZ1Q==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^28.0.0" + } + }, + "node_modules/@octokit/auth-app": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/@octokit/auth-app/-/auth-app-8.3.1.tgz", + "integrity": "sha512-XHWxZsF4mvGTQCv7AOxgby9t9OjVO19FBuKq+QmyBxFrf+B2hR/P5j/MTF8g95bITf8cRtR17KIXThpFNqiKbg==", + "license": "MIT", + "dependencies": { + "@octokit/auth-oauth-app": "^9.0.5", + "@octokit/auth-oauth-user": "^6.0.4", + "@octokit/request": "^10.0.16", + "@octokit/request-error": "^7.1.2", + "@octokit/types": "^18.0.0", + "toad-cache": "^3.7.0", + "universal-github-app-jwt": "^2.2.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-app/node_modules/@octokit/openapi-types": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-29.0.1.tgz", + "integrity": "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg==", + "license": "MIT" + }, + "node_modules/@octokit/auth-app/node_modules/@octokit/types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-18.0.0.tgz", + "integrity": "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^29.0.1" + } + }, + "node_modules/@octokit/auth-oauth-app": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-app/-/auth-oauth-app-9.0.5.tgz", + "integrity": "sha512-Hn2yAlIDjFLGjAz7t+CRu7e9VYoFW1W3LLyOLyahFoJGlCf4PtDkHKtRET8w/2CJpsrC0FxIF5g5Xtx9E4O78w==", + "license": "MIT", + "dependencies": { + "@octokit/auth-oauth-device": "^8.0.5", + "@octokit/auth-oauth-user": "^6.0.4", + "@octokit/request": "^10.0.16", + "@octokit/types": "^18.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-oauth-app/node_modules/@octokit/openapi-types": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-29.0.1.tgz", + "integrity": "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg==", + "license": "MIT" + }, + "node_modules/@octokit/auth-oauth-app/node_modules/@octokit/types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-18.0.0.tgz", + "integrity": "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^29.0.1" + } + }, + "node_modules/@octokit/auth-oauth-device": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-device/-/auth-oauth-device-8.0.5.tgz", + "integrity": "sha512-kdJtjRhykMLJrMdcoC56XUBDfoUAuWEFKpkDxwYim+bNwYw1MreLolk+PLnwEYT8djm589YepeMuJ8+ECAIzVQ==", + "license": "MIT", + "dependencies": { + "@octokit/oauth-methods": "^6.0.5", + "@octokit/request": "^10.0.16", + "@octokit/types": "^18.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-oauth-device/node_modules/@octokit/openapi-types": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-29.0.1.tgz", + "integrity": "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg==", + "license": "MIT" + }, + "node_modules/@octokit/auth-oauth-device/node_modules/@octokit/types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-18.0.0.tgz", + "integrity": "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^29.0.1" + } + }, + "node_modules/@octokit/auth-oauth-user": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-user/-/auth-oauth-user-6.0.4.tgz", + "integrity": "sha512-eya2pMJ9pCBq1jrm1Rf6J3NI+NemEpzDMLo9J/GpRoK0KgdxIVXWX4LESIfwJ+GYeoq6QFIlUJNi1lVp5FBgmw==", + "license": "MIT", + "dependencies": { + "@octokit/auth-oauth-device": "^8.0.5", + "@octokit/oauth-methods": "^6.0.5", + "@octokit/request": "^10.0.16", + "@octokit/types": "^18.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-oauth-user/node_modules/@octokit/openapi-types": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-29.0.1.tgz", + "integrity": "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg==", + "license": "MIT" + }, + "node_modules/@octokit/auth-oauth-user/node_modules/@octokit/types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-18.0.0.tgz", + "integrity": "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^29.0.1" + } + }, + "node_modules/@octokit/auth-token": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz", + "integrity": "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w==", + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-unauthenticated": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/@octokit/auth-unauthenticated/-/auth-unauthenticated-7.0.5.tgz", + "integrity": "sha512-KBzGMM8hRgtGKDe8JqvDdhHj+7PWHRo1qxz9pQ5WT1162DLdC6O5jL+kRFk3VfpCnEfc3bUYZ2vOwI9vx8yUXA==", + "license": "MIT", + "dependencies": { + "@octokit/request-error": "^7.1.2", + "@octokit/types": "^18.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-unauthenticated/node_modules/@octokit/openapi-types": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-29.0.1.tgz", + "integrity": "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg==", + "license": "MIT" + }, + "node_modules/@octokit/auth-unauthenticated/node_modules/@octokit/types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-18.0.0.tgz", + "integrity": "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^29.0.1" + } + }, + "node_modules/@octokit/core": { + "version": "7.0.8", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.8.tgz", + "integrity": "sha512-L7y8eYc+AwxGr2PWI4WFt1VG4TiJ66c26BD16mXpYIlXxG0SMigM1+m4aTSlYyBr5BlQsGAlz8uDCoZN4SEMcg==", + "license": "MIT", + "dependencies": { + "@octokit/auth-token": "^6.0.0", + "@octokit/graphql": "^9.0.5", + "@octokit/request": "^10.0.16", + "@octokit/request-error": "^7.1.2", + "@octokit/types": "^18.0.0", + "before-after-hook": "^4.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/core/node_modules/@octokit/openapi-types": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-29.0.1.tgz", + "integrity": "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg==", + "license": "MIT" + }, + "node_modules/@octokit/core/node_modules/@octokit/types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-18.0.0.tgz", + "integrity": "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^29.0.1" + } + }, + "node_modules/@octokit/endpoint": { + "version": "11.0.6", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-11.0.6.tgz", + "integrity": "sha512-H52ocs+dXsxmLtMPqabXz0p+mNWfe5RacpUHq8sB6mJLiMPU6PF/7O0Bl/U8a8WrV1NzWNYpXwZW0zo0BeoT2A==", + "license": "MIT", + "dependencies": { + "@octokit/types": "^18.0.0", + "universal-user-agent": "^7.0.2" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/endpoint/node_modules/@octokit/openapi-types": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-29.0.1.tgz", + "integrity": "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg==", + "license": "MIT" + }, + "node_modules/@octokit/endpoint/node_modules/@octokit/types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-18.0.0.tgz", + "integrity": "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^29.0.1" + } + }, + "node_modules/@octokit/graphql": { + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-9.0.6.tgz", + "integrity": "sha512-NZuqjuSGn8DEMq4fq/QWhg6DoqGdNOkKPi5R1kZ8Y3k+MqeRopYRSa3hccdHhGP4ISfV8BHv9+YURO4TEkbRWQ==", + "license": "MIT", + "dependencies": { + "@octokit/request": "^10.0.16", + "@octokit/types": "^18.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/graphql/node_modules/@octokit/openapi-types": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-29.0.1.tgz", + "integrity": "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg==", + "license": "MIT" + }, + "node_modules/@octokit/graphql/node_modules/@octokit/types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-18.0.0.tgz", + "integrity": "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^29.0.1" + } + }, + "node_modules/@octokit/oauth-app": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/@octokit/oauth-app/-/oauth-app-8.0.4.tgz", + "integrity": "sha512-Ji5JpRwAJcbOJkO4ij0tW6+GrQ8efpICnAca3o5xI8/HUNjqJu3hhG4cCZdXAHMKaOaQTFX0Yl+cpu61Rsx94A==", + "license": "MIT", + "dependencies": { + "@octokit/auth-oauth-app": "^9.0.4", + "@octokit/auth-oauth-user": "^6.0.3", + "@octokit/auth-unauthenticated": "^7.0.4", + "@octokit/core": "^7.0.7", + "@octokit/oauth-authorization-url": "^8.0.0", + "@octokit/oauth-methods": "^6.0.3", + "@types/aws-lambda": "^8.10.83", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/oauth-authorization-url": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@octokit/oauth-authorization-url/-/oauth-authorization-url-8.0.0.tgz", + "integrity": "sha512-7QoLPRh/ssEA/HuHBHdVdSgF8xNLz/Bc5m9fZkArJE5bb6NmVkDm3anKxXPmN1zh6b5WKZPRr3697xKT/yM3qQ==", + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/oauth-methods": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/@octokit/oauth-methods/-/oauth-methods-6.0.5.tgz", + "integrity": "sha512-/mAz7taDZD7DcV4zcG6TDw3Kr6TOldmYBRpvA62C3WIxRMmcgX8XxsTvVQomqKE7VEk/BgYhUao1aR2tYGyIKg==", + "license": "MIT", + "dependencies": { + "@octokit/oauth-authorization-url": "^8.0.0", + "@octokit/request": "^10.0.16", + "@octokit/request-error": "^7.1.2", + "@octokit/types": "^18.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/oauth-methods/node_modules/@octokit/openapi-types": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-29.0.1.tgz", + "integrity": "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg==", + "license": "MIT" + }, + "node_modules/@octokit/oauth-methods/node_modules/@octokit/types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-18.0.0.tgz", + "integrity": "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^29.0.1" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "27.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz", + "integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==", + "license": "MIT" + }, + "node_modules/@octokit/openapi-webhooks-types": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-webhooks-types/-/openapi-webhooks-types-12.1.0.tgz", + "integrity": "sha512-WiuzhOsiOvb7W3Pvmhf8d2C6qaLHXrWiLBP4nJ/4kydu+wpagV5Fkz9RfQwV2afYzv3PB+3xYgp4mAdNGjDprA==", + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-graphql": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-graphql/-/plugin-paginate-graphql-6.0.0.tgz", + "integrity": "sha512-crfpnIoFiBtRkvPqOyLOsw12XsveYuY2ieP6uYDosoUegBJpSVxGwut9sxUgFFcll3VTOTqpUf8yGd8x1OmAkQ==", + "license": "MIT", + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=6" + } + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-14.0.0.tgz", + "integrity": "sha512-fNVRE7ufJiAA3XUrha2omTA39M6IXIc6GIZLvlbsm8QOQCYvpq/LkMNGyFlB1d8hTDzsAXa3OKtybdMAYsV/fw==", + "license": "MIT", + "dependencies": { + "@octokit/types": "^16.0.0" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=6" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-17.0.0.tgz", + "integrity": "sha512-B5yCyIlOJFPqUUeiD0cnBJwWJO8lkJs5d8+ze9QDP6SvfiXSz1BF+91+0MeI1d2yxgOhU/O+CvtiZ9jSkHhFAw==", + "license": "MIT", + "dependencies": { + "@octokit/types": "^16.0.0" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=6" + } + }, + "node_modules/@octokit/plugin-retry": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-8.1.1.tgz", + "integrity": "sha512-VCVvZ/R1+u3WuiBWpNavZ0mY4aaJNAsENrpBP9aLSR2QyOpQgd7DhM5j4AW7z4MQpnJYgwBPf0XqPQoNBRdQwg==", + "license": "MIT", + "dependencies": { + "@octokit/request-error": "^7.1.1", + "@octokit/types": "^17.0.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=7" + } + }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/openapi-types": { + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-28.0.0.tgz", + "integrity": "sha512-0rFyLuyHvIj6uuZWuDslxkowFYdPXoNIkeAv4b27dzm2Tf4vGWXnPsMcxs7d65kLdMERgP3wc1AEPlqMz8e1cQ==", + "license": "MIT" + }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/types": { + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-17.0.0.tgz", + "integrity": "sha512-ByP1v7YL5SMveFPP7+sj0/ZuWCOOg/Chs4NafOMpq6WNIM/hdGY0S7C0TCGDBWu1aGmOxmUIhMx3cO+IdwYZ1Q==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^28.0.0" + } + }, + "node_modules/@octokit/plugin-throttling": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-11.0.5.tgz", + "integrity": "sha512-LIdrkrUv+DWbKeg/49rGuFJ3SU0d3hUS+B4MhNZLepBoNUFXms8Ic9edJjrlx+zycqJHjrMRudVpVb/bAXM2Lw==", + "license": "MIT", + "dependencies": { + "@octokit/types": "^17.0.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": "^7.0.0" + } + }, + "node_modules/@octokit/plugin-throttling/node_modules/@octokit/openapi-types": { + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-28.0.0.tgz", + "integrity": "sha512-0rFyLuyHvIj6uuZWuDslxkowFYdPXoNIkeAv4b27dzm2Tf4vGWXnPsMcxs7d65kLdMERgP3wc1AEPlqMz8e1cQ==", + "license": "MIT" + }, + "node_modules/@octokit/plugin-throttling/node_modules/@octokit/types": { + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-17.0.0.tgz", + "integrity": "sha512-ByP1v7YL5SMveFPP7+sj0/ZuWCOOg/Chs4NafOMpq6WNIM/hdGY0S7C0TCGDBWu1aGmOxmUIhMx3cO+IdwYZ1Q==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^28.0.0" + } + }, + "node_modules/@octokit/request": { + "version": "10.0.16", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.16.tgz", + "integrity": "sha512-A0zWGjHzISIb+9ccG8s0dq7LKO5zVpJLRICjgUb+sJxEWqn8RUHB1rD3AE51+PECvXHIxqZ1VVvs4fHTSD9nUQ==", + "license": "MIT", + "dependencies": { + "@octokit/endpoint": "^11.0.5", + "@octokit/request-error": "^7.1.2", + "@octokit/types": "^18.0.0", + "content-type": "^3.0.0", + "json-with-bigint": "^3.5.12", + "universal-user-agent": "^7.0.2" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/request-error": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.1.2.tgz", + "integrity": "sha512-XZRuT3xZ84D3gYErI1DZvhJ33dCWVV6uzBtWkaBB4TvA/L6eOeTZodxLFVB44bBEEo3vEx7y00UfX1tBLrtLRg==", + "license": "MIT", + "dependencies": { + "@octokit/types": "^18.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/request-error/node_modules/@octokit/openapi-types": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-29.0.1.tgz", + "integrity": "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg==", + "license": "MIT" + }, + "node_modules/@octokit/request-error/node_modules/@octokit/types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-18.0.0.tgz", + "integrity": "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^29.0.1" + } + }, + "node_modules/@octokit/request/node_modules/@octokit/openapi-types": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-29.0.1.tgz", + "integrity": "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg==", + "license": "MIT" + }, + "node_modules/@octokit/request/node_modules/@octokit/types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-18.0.0.tgz", + "integrity": "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^29.0.1" + } + }, + "node_modules/@octokit/types": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz", + "integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^27.0.0" + } + }, + "node_modules/@octokit/webhooks": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/@octokit/webhooks/-/webhooks-14.2.0.tgz", + "integrity": "sha512-da6KbdNCV5sr1/txD896V+6W0iamFWrvVl8cHkBSPT+YlvmT3DwXa4jxZnQc+gnuTEqSWbBeoSZYTayXH9wXcw==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-webhooks-types": "12.1.0", + "@octokit/request-error": "^7.0.0", + "@octokit/webhooks-methods": "^6.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/webhooks-methods": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/webhooks-methods/-/webhooks-methods-6.0.0.tgz", + "integrity": "sha512-MFlzzoDJVw/GcbfzVC1RLR36QqkTLUf79vLVO3D+xn7r0QgxnFoLZgtrzxiQErAjFUOdH6fas2KeQJ1yr/qaXQ==", + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@types/aws-lambda": { + "version": "8.10.164", + "resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.164.tgz", + "integrity": "sha512-XOnrazWcOd6yWPnR7DxqCBPPYciDjHq+NN8LPwwqBCJNXLyPJgKo47fZpJ113+oyAn9Zti0Cf6H4k6yPcE3WFg==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "26.6.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.11.tgz", + "integrity": "sha512-uUyQ2XLEz+EXh34lmS3GhKrkqn/8FU7KUiKRpk347At2bmnMVWss45yz8b4FG/tUtmV1tV/+TVkITItPROyeeQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~8.9.0" + } + }, + "node_modules/before-after-hook": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-4.0.0.tgz", + "integrity": "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ==", + "license": "Apache-2.0" + }, + "node_modules/bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", + "license": "MIT" + }, + "node_modules/content-type": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-3.1.1.tgz", + "integrity": "sha512-GW4qUsfFo59d0HbUibDlWv5wPz+vAAcaTWbKIuKCf0JkC7wWkSyf8f13IpXn5JkeMlB2P8iTSSIjwXljorg2vA==", + "license": "MIT", + "engines": { + "node": ">=22" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/json-with-bigint": { + "version": "3.5.12", + "resolved": "https://registry.npmjs.org/json-with-bigint/-/json-with-bigint-3.5.12.tgz", + "integrity": "sha512-uwbF/wSSuOgC7qqlq27Xp5B6a2MHVug3t0idZdTqu0JnlFvgJuH7ju+KAk/J06C7GfhoYy2gnb9wz2INqcne7w==", + "license": "MIT" + }, + "node_modules/octokit": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/octokit/-/octokit-5.0.5.tgz", + "integrity": "sha512-4+/OFSqOjoyULo7eN7EA97DE0Xydj/PW5aIckxqQIoFjFwqXKuFCvXUJObyJfBF9Khu4RL/jlDRI9FPaMGfPnw==", + "license": "MIT", + "dependencies": { + "@octokit/app": "^16.1.2", + "@octokit/core": "^7.0.6", + "@octokit/oauth-app": "^8.0.3", + "@octokit/plugin-paginate-graphql": "^6.0.0", + "@octokit/plugin-paginate-rest": "^14.0.0", + "@octokit/plugin-rest-endpoint-methods": "^17.0.0", + "@octokit/plugin-retry": "^8.0.3", + "@octokit/plugin-throttling": "^11.0.3", + "@octokit/request-error": "^7.0.2", + "@octokit/types": "^16.0.0", + "@octokit/webhooks": "^14.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/toad-cache": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/toad-cache/-/toad-cache-3.7.4.tgz", + "integrity": "sha512-m1TdR/rvT7kgGJZhspNtXdsdYk0fddFpJJFlG5s+UkPFo6lkLoZ3YLOaovPYjq1R75NP5JfeTlSHaOsE09peCg==", + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz", + "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==", + "dev": true, + "license": "MIT" + }, + "node_modules/universal-github-app-jwt": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/universal-github-app-jwt/-/universal-github-app-jwt-2.2.2.tgz", + "integrity": "sha512-dcmbeSrOdTnsjGjUfAlqNDJrhxXizjAz94ija9Qw8YkZ1uu0d+GoZzyH+Jb9tIIqvGsadUfwg+22k5aDqqwzbw==", + "license": "MIT" + }, + "node_modules/universal-user-agent": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz", + "integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==", + "license": "ISC" + }, + "node_modules/yaml": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.1.tgz", + "integrity": "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==", + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + }, + "funding": { + "url": "https://github.com/sponsors/eemeli" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..622b5e0 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "@nvisy/github", + "private": true, + "description": "Organization-wide defaults and automation for Nvisy's open-source repositories", + "type": "module", + "engines": { + "node": ">=24.0.0" + }, + "scripts": { + "check": "biome check .", + "check:fix": "biome check --write .", + "typecheck": "tsc", + "labels": "node scripts/labels-sync.ts", + "project-sync": "node scripts/project-sync.ts" + }, + "dependencies": { + "octokit": "^5.0.5", + "yaml": "^2.9.1" + }, + "devDependencies": { + "@biomejs/biome": "^2.6.9", + "@types/node": "^26.4.0", + "typescript": "^5.9.3" + } +} diff --git a/scripts/github.ts b/scripts/github.ts new file mode 100644 index 0000000..862e63d --- /dev/null +++ b/scripts/github.ts @@ -0,0 +1,20 @@ +/** + * The GitHub client and settings both scripts share. Octokit's defaults retry + * transient failures and wait out primary and secondary rate limits. + * + * Environment: + * GH_TOKEN token the scripts act as (falls back to GITHUB_TOKEN) + * ORG organization login (default: nvisycom) + * DRY_RUN "1" to report changes without making them + */ +import { Octokit } from "octokit"; + +const token = process.env.GH_TOKEN ?? process.env.GITHUB_TOKEN; +if (!token) { + console.error("GH_TOKEN is not set"); + process.exit(1); +} + +export const ORG = process.env.ORG ?? "nvisycom"; +export const DRY_RUN = process.env.DRY_RUN === "1"; +export const github = new Octokit({ auth: token }); diff --git a/scripts/labels-sync.mjs b/scripts/labels-sync.mjs deleted file mode 100644 index 9dc1e62..0000000 --- a/scripts/labels-sync.mjs +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env node -/** - * Create or correct the labels in labels.yml in every public, unarchived - * repository of the organization. Never deletes a label. - * - * Environment: GH_TOKEN (issues read/write on the repositories), ORG, and - * DRY_RUN="1" to report the changes without making them. - */ -import { readFile } from "node:fs/promises"; - -const ORG = process.env.ORG ?? "nvisycom"; -const TOKEN = process.env.GH_TOKEN; -const DRY_RUN = process.env.DRY_RUN === "1"; -if (!TOKEN) { - console.error("GH_TOKEN is not set"); - process.exit(1); -} - -async function api(path, init = {}) { - const response = await fetch(`https://api.github.com${path}`, { - ...init, - headers: { - authorization: `Bearer ${TOKEN}`, - accept: "application/vnd.github+json", - "content-type": "application/json", - "user-agent": "nvisycom-labels-sync", - }, - }); - if (!response.ok && response.status !== 404) { - throw new Error(`${init.method ?? "GET"} ${path}: ${response.status} ${await response.text()}`); - } - return response.status === 404 ? null : response.json(); -} - -/** labels.yml is a flat list of name/color/description, so parse it by hand. */ -function parse(text) { - const labels = []; - for (const line of text.split("\n")) { - const m = line.match(/^\s*-?\s*(name|color|description):\s*(.*)$/); - if (!m) continue; - if (m[1] === "name") labels.push({}); - labels[labels.length - 1][m[1]] = m[2].trim(); - } - return labels; -} - -const wanted = parse(await readFile("labels.yml", "utf8")); -const repos = (await api(`/orgs/${ORG}/repos?type=public&per_page=100`)).filter( - (repo) => !repo.archived, -); - -for (const repo of repos) { - const have = new Map( - (await api(`/repos/${ORG}/${repo.name}/labels?per_page=100`)).map((l) => [ - l.name.toLowerCase(), - l, - ]), - ); - for (const label of wanted) { - const current = have.get(label.name.toLowerCase()); - if (!current) { - if (!DRY_RUN) await api(`/repos/${ORG}/${repo.name}/labels`, { - method: "POST", - body: JSON.stringify(label), - }); - console.log(`${repo.name}: ${DRY_RUN ? "would create" : "created"} ${label.name}`); - } else if (current.color !== label.color || (current.description ?? "") !== label.description) { - if (!DRY_RUN) await api(`/repos/${ORG}/${repo.name}/labels/${encodeURIComponent(current.name)}`, { - method: "PATCH", - body: JSON.stringify({ color: label.color, description: label.description }), - }); - console.log(`${repo.name}: ${DRY_RUN ? "would update" : "updated"} ${label.name}`); - } - } -} diff --git a/scripts/labels-sync.ts b/scripts/labels-sync.ts new file mode 100644 index 0000000..b388685 --- /dev/null +++ b/scripts/labels-sync.ts @@ -0,0 +1,86 @@ +#!/usr/bin/env node +/** + * Create or correct the labels in labels.yml in every public, unarchived + * repository of the organization. Never deletes a label. + * + * Environment: see github.ts. The token needs issues read/write on the + * repositories. + */ +import { readFile } from "node:fs/promises"; +import { parse as parseYaml } from "yaml"; +import { DRY_RUN, github, ORG } from "./github.ts"; + +interface Label { + name: string; + color: string; + description: string; +} + +/** The labels in labels.yml, rejecting any entry GitHub would refuse. */ +function parse(text: string): Label[] { + const labels: unknown = parseYaml(text); + if (!Array.isArray(labels)) throw new Error("labels.yml: expected a list"); + for (const label of labels) { + const { name, color, description } = label ?? {}; + // A colour YAML reads as a number (123456, 1e5000) must be quoted. + if ( + typeof name !== "string" || + typeof color !== "string" || + !/^[0-9a-f]{6}$/.test(color) || + typeof description !== "string" + ) { + throw new Error(`labels.yml: invalid label ${JSON.stringify(label)}`); + } + } + return labels as Label[]; +} + +const wanted = parse(await readFile("labels.yml", "utf8")); +const repos = ( + await github.paginate(github.rest.repos.listForOrg, { + org: ORG, + type: "public", + per_page: 100, + }) +).filter((repo) => !repo.archived); + +for (const repo of repos) { + const target = { owner: ORG, repo: repo.name }; + const have = new Map( + ( + await github.paginate(github.rest.issues.listLabelsForRepo, { + ...target, + per_page: 100, + }) + ).map((label) => [label.name.toLowerCase(), label]), + ); + for (const label of wanted) { + const current = have.get(label.name.toLowerCase()); + if (!current) { + if (!DRY_RUN) + await github.rest.issues.createLabel({ ...target, ...label }); + console.log( + `${repo.name}: ${DRY_RUN ? "would create" : "created"} ${label.name}`, + ); + } else if ( + current.color !== label.color || + (current.description ?? "") !== label.description + ) { + if (!DRY_RUN) { + await github.rest.issues.updateLabel({ + ...target, + name: current.name, + color: label.color, + description: label.description, + }); + } + console.log( + `${repo.name}: ${DRY_RUN ? "would update" : "updated"} ${label.name}`, + ); + } + } +} + +console.log( + `${DRY_RUN ? "checked" : "synced"} ${wanted.length} labels across ${repos.length} public repositories`, +); diff --git a/scripts/project-sync.mjs b/scripts/project-sync.mjs deleted file mode 100644 index bf828d6..0000000 --- a/scripts/project-sync.mjs +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env node -/** - * Keep the "Nvisy OSS" project in step with the organization's open-source - * repositories: every open issue and pull request in a public, unarchived - * repository is added to the project if it is not there yet. Pull requests - * opened by bots (Dependabot and the like) are left out. - * - * Adding an item that is already on the project changes nothing, so the sync - * is safe to run as often as needed; it also backfills on its first run. New - * repositories are picked up with no setup. Status after that is the - * project's own built-in workflows' job (item added, closed, merged). - * - * Environment: - * GH_TOKEN token with read/write on organization projects and read - * access to issues and pull requests - * ORG organization login (default: nvisycom) - * PROJECT_NUMBER project number (default: 7) - * DRY_RUN "1" to report what would be added without adding it - */ - -const ORG = process.env.ORG ?? "nvisycom"; -const PROJECT_NUMBER = Number(process.env.PROJECT_NUMBER ?? 7); -const DRY_RUN = process.env.DRY_RUN === "1"; -const TOKEN = process.env.GH_TOKEN ?? process.env.GITHUB_TOKEN; - -if (!TOKEN) { - console.error("GH_TOKEN is not set"); - process.exit(1); -} - -async function graphql(query, variables = {}) { - const response = await fetch("https://api.github.com/graphql", { - method: "POST", - headers: { - authorization: `Bearer ${TOKEN}`, - "content-type": "application/json", - "user-agent": "nvisycom-project-sync", - }, - body: JSON.stringify({ query, variables }), - }); - const body = await response.json(); - if (!response.ok || body.errors) { - throw new Error(JSON.stringify(body.errors ?? body, null, 2)); - } - return body.data; -} - -/** The project's id and the ids of everything already on it. */ -async function projectItems() { - const ids = new Set(); - let projectId; - let after = null; - do { - const data = await graphql( - `query($org: String!, $number: Int!, $after: String) { - organization(login: $org) { - projectV2(number: $number) { - id - items(first: 100, after: $after) { - pageInfo { hasNextPage endCursor } - nodes { content { ... on Issue { id } ... on PullRequest { id } } } - } - } - } - }`, - { org: ORG, number: PROJECT_NUMBER, after }, - ); - const project = data.organization.projectV2; - projectId = project.id; - for (const item of project.items.nodes) { - if (item.content?.id) ids.add(item.content.id); - } - after = project.items.pageInfo.hasNextPage - ? project.items.pageInfo.endCursor - : null; - } while (after); - return { projectId, ids }; -} - -/** Public, unarchived repositories of the organization. */ -async function publicRepositories() { - const names = []; - let after = null; - do { - const data = await graphql( - `query($org: String!, $after: String) { - organization(login: $org) { - repositories(first: 100, after: $after, privacy: PUBLIC, isArchived: false) { - pageInfo { hasNextPage endCursor } - nodes { name } - } - } - }`, - { org: ORG, after }, - ); - const page = data.organization.repositories; - names.push(...page.nodes.map((repo) => repo.name)); - after = page.pageInfo.hasNextPage ? page.pageInfo.endCursor : null; - } while (after); - return names; -} - -/** Open issues and pull requests in one repository, without bot PRs. */ -async function openWork(repo) { - const found = []; - for (const kind of ["issues", "pullRequests"]) { - let after = null; - do { - const data = await graphql( - `query($org: String!, $repo: String!, $after: String) { - repository(owner: $org, name: $repo) { - ${kind}(first: 100, after: $after, states: OPEN) { - pageInfo { hasNextPage endCursor } - nodes { id number title author { __typename login } } - } - } - }`, - { org: ORG, repo, after }, - ); - const page = data.repository[kind]; - for (const node of page.nodes) { - const bot = node.author?.__typename === "Bot"; - if (kind === "pullRequests" && bot) continue; - found.push({ ...node, repo, kind }); - } - after = page.pageInfo.hasNextPage ? page.pageInfo.endCursor : null; - } while (after); - } - return found; -} - -const { projectId, ids } = await projectItems(); -const repos = await publicRepositories(); -let added = 0; - -for (const repo of repos) { - for (const item of await openWork(repo)) { - if (ids.has(item.id)) continue; - const label = `${repo}#${item.number} ${item.title}`; - if (DRY_RUN) { - console.log(`would add ${label}`); - } else { - await graphql( - `mutation($project: ID!, $content: ID!) { - addProjectV2ItemById(input: { projectId: $project, contentId: $content }) { item { id } } - }`, - { project: projectId, content: item.id }, - ); - console.log(`added ${label}`); - } - added++; - } -} - -console.log( - `${DRY_RUN ? "would add" : "added"} ${added} item(s) across ${repos.length} public repositories`, -); diff --git a/scripts/project-sync.ts b/scripts/project-sync.ts new file mode 100644 index 0000000..5b1afcb --- /dev/null +++ b/scripts/project-sync.ts @@ -0,0 +1,119 @@ +#!/usr/bin/env node +/** + * Keep the "Nvisy OSS" project in step with the organization's open-source + * repositories: every open issue and pull request in a public, unarchived + * repository is added to the project if it is not there yet. Pull requests + * opened by bots (Dependabot and the like) are left out. + * + * New repositories are picked up with no setup. Each open item is checked + * against the projects it is on, archived entries included, so the cost grows + * with open work rather than with the project's history, and an item archived + * by hand is not brought back. Safe to run as often as needed. Status after that is the + * project's own built-in workflows' job (item added, closed, merged). + * + * Environment: see github.ts, plus PROJECT_NUMBER (default: 7). The token + * needs read/write on organization projects and read access to issues and + * pull requests. + */ +import { DRY_RUN, github, ORG } from "./github.ts"; + +const PROJECT_NUMBER = Number(process.env.PROJECT_NUMBER ?? 7); + +interface Work { + id: string; + number: number; + title: string; + author: { __typename: string } | null; + /** Projects the item is on, archived ones included. */ + projectItems: { nodes: { project: { id: string } }[] }; +} + +/** The project's node id, which the add mutation needs. */ +async function projectId(): Promise { + const data = await github.graphql<{ + organization: { projectV2: { id: string } }; + }>( + `query($org: String!, $number: Int!) { + organization(login: $org) { projectV2(number: $number) { id } } + }`, + { org: ORG, number: PROJECT_NUMBER }, + ); + return data.organization.projectV2.id; +} + +/** Public, unarchived repositories of the organization. */ +async function publicRepositories(): Promise { + const data = await github.graphql.paginate<{ + organization: { repositories: { nodes: { name: string }[] } }; + }>( + `query($org: String!, $cursor: String) { + organization(login: $org) { + repositories(first: 100, after: $cursor, privacy: PUBLIC, isArchived: false) { + pageInfo { hasNextPage endCursor } + nodes { name } + } + } + }`, + { org: ORG }, + ); + return data.organization.repositories.nodes.map((repo) => repo.name); +} + +/** Open issues and pull requests in one repository, without bot PRs. */ +async function openWork(repo: string): Promise { + const found: Work[] = []; + for (const kind of ["issues", "pullRequests"] as const) { + const data = await github.graphql.paginate<{ + repository: Record; + }>( + `query($org: String!, $repo: String!, $cursor: String) { + repository(owner: $org, name: $repo) { + ${kind}(first: 100, after: $cursor, states: OPEN) { + pageInfo { hasNextPage endCursor } + nodes { + id number title author { __typename } + projectItems(first: 20) { nodes { project { id } } } + } + } + } + }`, + { org: ORG, repo }, + ); + for (const node of data.repository[kind].nodes) { + if (kind === "pullRequests" && node.author?.__typename === "Bot") + continue; + found.push(node); + } + } + return found; +} + +const project = await projectId(); +const repos = await publicRepositories(); +let added = 0; + +for (const repo of repos) { + for (const item of await openWork(repo)) { + const onProject = item.projectItems.nodes.some( + (entry) => entry.project.id === project, + ); + if (onProject) continue; + const label = `${repo}#${item.number} ${item.title}`; + if (DRY_RUN) { + console.log(`would add ${label}`); + } else { + await github.graphql( + `mutation($project: ID!, $content: ID!) { + addProjectV2ItemById(input: { projectId: $project, contentId: $content }) { item { id } } + }`, + { project, content: item.id }, + ); + console.log(`added ${label}`); + } + added++; + } +} + +console.log( + `${DRY_RUN ? "would add" : "added"} ${added} item(s) across ${repos.length} public repositories`, +); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..8093d06 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "target": "ES2024", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "lib": ["ES2024"], + "types": ["node"], + + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + + "noEmit": true, + "erasableSyntaxOnly": true, + "verbatimModuleSyntax": true, + "allowImportingTsExtensions": true, + "forceConsistentCasingInFileNames": true, + "skipLibCheck": true + }, + "include": ["scripts/**/*"] +}