diff --git a/.github/workflows/release-notification.yml b/.github/workflows/release-notification.yml index 22f0642af..ba9a962f8 100644 --- a/.github/workflows/release-notification.yml +++ b/.github/workflows/release-notification.yml @@ -12,4 +12,3 @@ jobs: with: app_id: ${{ secrets.RELEASE_NOTIFIER_APP_ID }} private_key: ${{ secrets.RELEASE_NOTIFIER_APP_PRIVATE_KEY }} - dispatch_event_type: "octokit/openapi-types.ts release" diff --git a/package.json b/package.json index af8041013..5140196fe 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,6 @@ { "name": "@octokit/openapi-types", - "publishConfig": { - "access": "public" - }, + "publishConfig": { "access": "public" }, "version": "1.0.0", "description": "Generated TypeScript definitions based on GitHub's OpenAPI spec", "main": "generated/types.ts", @@ -12,12 +10,10 @@ "license": "MIT", "scripts": { "download": "node scripts/download", - "generate-types": "npx openapi-typescript cache/openapi-schema.json -o generated/types.ts" - }, - "devDependencies": { - "openapi-typescript": "^2.4.2" + "generate-types": "npx openapi-typescript cache/openapi-schema.json -o generated/types.ts", + "postgenerate-types": "node scripts/update-package" }, - "release": { - "branches": "main" - } + "devDependencies": { "openapi-typescript": "^2.4.2", "prettier": "^2.2.1" }, + "release": { "branches": "main" }, + "octokit": { "openapi-version": "1.0.1" } } diff --git a/scripts/update-package.js b/scripts/update-package.js new file mode 100644 index 000000000..b72c5f8fd --- /dev/null +++ b/scripts/update-package.js @@ -0,0 +1,19 @@ +const { writeFileSync } = require("fs"); +const prettier = require("prettier"); + +if (!process.env.VERSION) { + throw new Error("VERSION is not set"); +} + +const pkg = require("../package.json"); + +if (!pkg.octokit) { + pkg.octokit = {}; +} + +pkg.octokit["openapi-version"] = process.env.VERSION; + +writeFileSync( + "package.json", + prettier.format(JSON.stringify(pkg), { parser: "json" }) +);