diff --git a/src/application/release-event-handler.ts b/src/application/release-event-handler.ts index c8f5ec7..8324632 100644 --- a/src/application/release-event-handler.ts +++ b/src/application/release-event-handler.ts @@ -42,6 +42,7 @@ export class ReleaseEventHandler { event.payload.sender.login, repository ); + const releaseUrl = event.payload.release.url; const tag = event.payload.release.tag_name; @@ -110,7 +111,8 @@ export class ReleaseEventHandler { bcr, branch, releaser, - rulesetRepo.getModuleName(moduleRoot) + rulesetRepo.getModuleName(moduleRoot), + releaseUrl ); console.log(`Created pull request against ${bcr.canonicalName}`); diff --git a/src/domain/publish-entry.spec.ts b/src/domain/publish-entry.spec.ts index 1160fef..2d07720 100644 --- a/src/domain/publish-entry.spec.ts +++ b/src/domain/publish-entry.spec.ts @@ -31,7 +31,8 @@ describe("sendRequest", () => { bcr, branch, releaser, - "rules_foo" + "rules_foo", + `github.com/aspect-build/rules_foo/releases/tag/${tag}` ); expect(mockGithubClient.createPullRequest).toHaveBeenCalledWith( @@ -61,7 +62,8 @@ describe("sendRequest", () => { bcr, branch, releaser, - "rules_foo" + "rules_foo", + `github.com/aspect-build/rules_foo/releases/tag/${tag}` ); expect(mockGithubClient.createPullRequest).toHaveBeenCalledWith( @@ -99,7 +101,8 @@ describe("sendRequest", () => { bcr, branch, releaser, - "rules_foo" + "rules_foo", + `github.com/aspect-build/rules_foo/releases/tag/${tag}` ); expect(mockGithubClient.createPullRequest).toHaveBeenCalledWith( @@ -112,6 +115,39 @@ describe("sendRequest", () => { ); }); + test("incliudes the release url in the body", async () => { + const bcrFork = new Repository("bazel-central-registry", "bar"); + const bcr = new Repository("bazel-central-registry", "bazelbuild"); + const branch = "branch_with_entry"; + const tag = "v1.0.0"; + const releaser = { + name: "Json Bearded", + username: "json", + email: "jason@foo.org", + }; + + await publishEntryService.sendRequest( + tag, + bcrFork, + bcr, + branch, + releaser, + "rules_foo", + `github.com/aspect-build/rules_foo/releases/tag/${tag}` + ); + + expect(mockGithubClient.createPullRequest).toHaveBeenCalledWith( + expect.any(Repository), + expect.any(String), + expect.any(Repository), + expect.any(String), + expect.any(String), + expect.stringContaining( + `github.com/aspect-build/rules_foo/releases/tag/${tag}` + ) + ); + }); + test("creates the created pull request number", async () => { const bcrFork = new Repository("bazel-central-registry", "bar"); const bcr = new Repository("bazel-central-registry", "bazelbuild"); @@ -131,7 +167,8 @@ describe("sendRequest", () => { bcr, branch, releaser, - "rules_foo" + "rules_foo", + `github.com/aspect-build/rules_foo/releases/tag/${tag}` ); expect(pr).toEqual(4); diff --git a/src/domain/publish-entry.ts b/src/domain/publish-entry.ts index a1ef591..56f47b5 100644 --- a/src/domain/publish-entry.ts +++ b/src/domain/publish-entry.ts @@ -12,9 +12,11 @@ export class PublishEntryService { bcr: Repository, branch: string, releaser: User, - moduleName: string + moduleName: string, + releaseUrl: string ): Promise { const version = RulesetRepository.getVersionFromTag(tag); + const pr = await this.githubClient.createPullRequest( bcrForkRepo, branch, @@ -22,7 +24,9 @@ export class PublishEntryService { "main", `${moduleName}@${version}`, `\ -Release author: @${releaser.username}. +Release: [${tag}](${releaseUrl}) + +Author: @${releaser.username}. Automated by [Publish to BCR](https://github.com/apps/publish-to-bcr).` );