Skip to content

Commit

Permalink
feat: Add "octokit": { "openapi-version": "1.0.1" } to package.json (
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m authored Nov 30, 2020
1 parent 7ab6b5f commit d367820
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
1 change: 0 additions & 1 deletion .github/workflows/release-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
16 changes: 6 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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" }
}
19 changes: 19 additions & 0 deletions scripts/update-package.js
Original file line number Diff line number Diff line change
@@ -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" })
);

0 comments on commit d367820

Please sign in to comment.