diff --git a/changelog.d/582.bugfix b/changelog.d/582.bugfix new file mode 100644 index 00000000..5772615e --- /dev/null +++ b/changelog.d/582.bugfix @@ -0,0 +1 @@ +Ensure bridge treats published and drafted GitHub releases as different events. \ No newline at end of file diff --git a/docs/usage/room_configuration/github_repo.md b/docs/usage/room_configuration/github_repo.md index aa74bbb9..53968ec1 100644 --- a/docs/usage/room_configuration/github_repo.md +++ b/docs/usage/room_configuration/github_repo.md @@ -65,6 +65,7 @@ Note: Some of these event types are enabled by default (marked with a `*`) - pull_request.reviewed * - release * - release.created * + - release.drafted - workflow.run - workflow.run.success - workflow.run.failure diff --git a/src/Bridge.ts b/src/Bridge.ts index c90ac1f8..22318d6c 100644 --- a/src/Bridge.ts +++ b/src/Bridge.ts @@ -328,10 +328,16 @@ export class Bridge { (c, data) => c.onWorkflowCompleted(data), ); + this.bindHandlerToQueue( + "github.release.published", + (data) => connManager.getConnectionsForGithubRepo(data.repository.owner.login, data.repository.name), + (c, data) => c.onReleaseCreated(data), + ); + this.bindHandlerToQueue( "github.release.created", (data) => connManager.getConnectionsForGithubRepo(data.repository.owner.login, data.repository.name), - (c, data) => c.onReleaseCreated(data), + (c, data) => c.onReleaseDrafted(data), ); this.bindHandlerToQueue( diff --git a/src/Connections/GithubRepo.ts b/src/Connections/GithubRepo.ts index e50168ea..21c94ef4 100644 --- a/src/Connections/GithubRepo.ts +++ b/src/Connections/GithubRepo.ts @@ -6,8 +6,8 @@ import { FormatUtil } from "../FormatUtil"; import { Connection, IConnection, IConnectionState, InstantiateConnectionOpts, ProvisionConnectionOpts } from "./IConnection"; import { GetConnectionsResponseItem } from "../provisioning/api"; import { IssuesOpenedEvent, IssuesReopenedEvent, IssuesEditedEvent, PullRequestOpenedEvent, IssuesClosedEvent, PullRequestClosedEvent, - PullRequestReadyForReviewEvent, PullRequestReviewSubmittedEvent, ReleaseCreatedEvent, IssuesLabeledEvent, IssuesUnlabeledEvent, - WorkflowRunCompletedEvent, + PullRequestReadyForReviewEvent, PullRequestReviewSubmittedEvent, ReleasePublishedEvent, ReleaseCreatedEvent, + IssuesLabeledEvent, IssuesUnlabeledEvent, WorkflowRunCompletedEvent, } from "@octokit/webhooks-types"; import { MatrixMessageContent, MatrixEvent, MatrixReactionContent } from "../MatrixEvent"; import { MessageSenderClient } from "../MatrixSender"; @@ -94,6 +94,7 @@ type AllowedEventsNames = "pull_request.reviewed" | "pull_request" | "release.created" | + "release.drafted" | "release" | "workflow" | "workflow.run" | @@ -118,6 +119,7 @@ const AllowedEvents: AllowedEventsNames[] = [ "pull_request.reviewed" , "pull_request" , "release.created" , + "release.drafted" , "release", "workflow", "workflow.run", @@ -137,7 +139,7 @@ const AllowedEvents: AllowedEventsNames[] = [ const AllowHookByDefault: AllowedEventsNames[] = [ "issue", "pull_request", - "release", + "release.created" ]; const ConnectionStateSchema = { @@ -1069,7 +1071,11 @@ export class GitHubRepoConnection extends CommandConnectionAction Required Stale - Releases + Releases +
    + Published + Drafted +