Skip to content

Commit

Permalink
fix(deps): update dependency @octokit/openapi-webhooks-types to v6 (#978
Browse files Browse the repository at this point in the history
)

* chore(deps): update dependency @octokit/openapi-webhooks to v6

* fix(deps): update dependency @octokit/openapi-webhooks-types to v6

* ci(workflow): adapt for new OpenAPI spec

* chore: update README

* build: ignore typescript errors

The package simply doesn't have any types, it's safe to ignore

* docs: update README with new event

* maint: add other possible renovate branch

* ci: also add branch for major versions

* build: upgrade openapi-webhooks

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: wolfy1339 <webmaster@wolfy1339.com>
  • Loading branch information
renovate[bot] and wolfy1339 authored Feb 24, 2024
1 parent bd224a1 commit bb573c8
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 41 deletions.
36 changes: 8 additions & 28 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Update
"on":
repository_dispatch:
types:
- octokit/webhooks release
push:
branches:
- renovate/octokit-openapi-webhooks-*
- renovate/octokit-monorepo
- renovate/major-octokit-monorepo
jobs:
update:
runs-on: ubuntu-latest
Expand All @@ -11,38 +13,16 @@ jobs:
- uses: actions/setup-node@v4
with:
cache: npm
node-version: 16
node-version: 20
- run: npm ci
- uses: gr2m/await-npm-package-version-action@v1
with:
package: "@octokit/webhooks-schemas"
version: ${{ github.event.client_payload.release.tag_name }}
- run: npm install --save-exact --save-dev @octokit/webhooks-schemas@latest
- uses: gr2m/await-npm-package-version-action@v1
with:
package: "@octokit/webhooks-types"
version: ${{ github.event.client_payload.release.tag_name }}
- run: npm install --save-exact @octokit/webhooks-types@latest
- run: npm run generate-types
- name: create pull request
uses: gr2m/create-or-update-pull-request-action@v1.x
env:
GITHUB_TOKEN: ${{ secrets.OCTOKITBOT_PAT }}
with:
title: 🚧 🤖📯 Webhooks changed
body: >
A new release of
[@octokit/webhooks-definitions](https://github.com/octokit/webhooks)
was just released 👋🤖
This pull request updates the TypeScript definitions derived from
`@octokit/webhooks-definitions`. I can't tell if the changes are
fixes, features or breaking, you'll have to figure that out on
yourself and adapt the commit messages accordingly to trigger the
right release, see [our commit message
conventions](https://github.com/octokit/openapi/blob/main/CONTRIBUTING.md#merging-the-pull-request--releasing-a-new-version).
branch: update-octokit-webhooks
body: An update to the OpenAPI spec has been detected, and required updates to your code. Please review the changes and merge this PR if everything looks good.
branch: ${{ github.ref }}
author: Octokit Bot <octokitbot@martynus.net>
commit-message: "WIP: Webhooks changed - please review"
labels: "Type: Maintenance"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ If there are actions for a webhook, events are emitted for both, the webhook nam
| [`repository_import`](https://docs.github.com/en/webhooks/webhook-events-and-payloads#repository_import) | |
| [`repository_ruleset`](https://docs.github.com/en/webhooks/webhook-events-and-payloads#repository_ruleset) | `created`<br>`deleted`<br>`edited` |
| [`repository_vulnerability_alert`](https://docs.github.com/en/webhooks/webhook-events-and-payloads#repository_vulnerability_alert) | `create`<br>`dismiss`<br>`reopen`<br>`resolve` |
| [`secret_scanning_alert`](https://docs.github.com/en/webhooks/webhook-events-and-payloads#secret_scanning_alert) | `created`<br>`reopened`<br>`resolved`<br>`revoked` |
| [`secret_scanning_alert`](https://docs.github.com/en/webhooks/webhook-events-and-payloads#secret_scanning_alert) | `created`<br>`reopened`<br>`resolved`<br>`revoked`<br>`validated` |
| [`secret_scanning_alert_location`](https://docs.github.com/en/webhooks/webhook-events-and-payloads#secret_scanning_alert_location) | `created` |
| [`security_advisory`](https://docs.github.com/en/webhooks/webhook-events-and-payloads#security_advisory) | `published`<br>`updated`<br>`withdrawn` |
| [`security_and_analysis`](https://docs.github.com/en/webhooks/webhook-events-and-payloads#security_and_analysis) | |
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@
]
},
"dependencies": {
"@octokit/openapi-webhooks-types": "5.3.2",
"@octokit/openapi-webhooks-types": "6.0.1",
"@octokit/request-error": "^6.0.1",
"@octokit/webhooks-methods": "^5.0.0",
"aggregate-error": "^5.0.0"
},
"devDependencies": {
"@jest/types": "^29.0.0",
"@octokit/openapi-webhooks": "5.3.2",
"@octokit/openapi-webhooks": "6.0.1",
"@octokit/tsconfig": "^3.0.0",
"@types/jest": "^29.0.0",
"@types/node": "^20.0.0",
Expand Down
3 changes: 2 additions & 1 deletion scripts/generate-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as fs from "node:fs";
import type { OpenAPI3, OperationObject, PathItemObject } from "./types.js";
import { format } from "prettier";

// @ts-expect-error - There is no type definition for this package, your IDE may complain that this directive is unused but it is not
const schema = (await import("@octokit/openapi-webhooks")).default.schemas[
"api.github.com"
] as OpenAPI3;
Expand Down Expand Up @@ -130,5 +131,5 @@ const run = async () => {

await updateReadme(emitterEvents);
};

console.log("Generating types...");
run();
3 changes: 2 additions & 1 deletion src/generated/webhook-identifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ export type EventPayloadMap = {
| WebhookEventDefinition<"secret-scanning-alert-created">
| WebhookEventDefinition<"secret-scanning-alert-reopened">
| WebhookEventDefinition<"secret-scanning-alert-resolved">
| WebhookEventDefinition<"secret-scanning-alert-revoked">;
| WebhookEventDefinition<"secret-scanning-alert-revoked">
| WebhookEventDefinition<"secret-scanning-alert-validated">;
secret_scanning_alert_location: WebhookEventDefinition<"secret-scanning-alert-location-created">;
security_advisory:
| WebhookEventDefinition<"security-advisory-published">
Expand Down
1 change: 1 addition & 0 deletions src/generated/webhook-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export const emitterEventNames = [
"secret_scanning_alert.reopened",
"secret_scanning_alert.resolved",
"secret_scanning_alert.revoked",
"secret_scanning_alert.validated",
"secret_scanning_alert_location",
"secret_scanning_alert_location.created",
"security_advisory",
Expand Down

0 comments on commit bb573c8

Please sign in to comment.