Skip to content

Commit ffd6f39

Browse files
authored
feat: stop tagging author and maintainers in pr body (#155)
1 parent 836d047 commit ffd6f39

File tree

6 files changed

+3
-150
lines changed

6 files changed

+3
-150
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Prepare your ruleset for bzlmod by following the [Bzlmod User Guide](https://baz
1717
_Note: Authors of rulesets under the `bazelbuild` org should add the app to their personal fork of `bazelbuild/bazel-central-registry`._
1818

1919
1. Include these [template files](./templates) in your ruleset repository.
20-
1. Cut a release. You will be tagged in a pull request against the BCR.
20+
1. Cut a release. A pull request like [this](https://github.com/bazelbuild/bazel-central-registry/pull/1601) will be opened against the BCR.
2121

2222
## Publishing multiple modules in the same repo
2323

e2e/e2e.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,6 @@ describe("e2e tests", () => {
441441
})
442442
);
443443

444-
// PR body tags releaser and maintainer
445-
expect(body.body).toEqual(expect.stringContaining(`@${releaser.login}`));
446-
expect(body.body).toEqual(expect.stringContaining(`@foobar`));
447-
448444
// PR body has a link to the github release
449445
expect(body.body).toEqual(
450446
expect.stringContaining(

src/application/release-event-handler.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,6 @@ export class ReleaseEventHandler {
270270
bcrFork,
271271
bcr,
272272
branch,
273-
releaser,
274-
rulesetRepo.metadataTemplate(moduleRoot).maintainers,
275273
rulesetRepo.getModuleName(moduleRoot),
276274
releaseUrl
277275
);

src/domain/publish-entry.spec.ts

Lines changed: 1 addition & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,12 @@ describe("sendRequest", () => {
1919
const bcr = new Repository("bazel-central-registry", "bazelbuild");
2020
const branch = "branch_with_entry";
2121
const tag = "v1.0.0";
22-
const releaser = {
23-
name: "Json Bearded",
24-
username: "json",
25-
26-
};
2722

2823
await publishEntryService.sendRequest(
2924
tag,
3025
bcrFork,
3126
bcr,
3227
branch,
33-
releaser,
34-
[],
3528
"rules_foo",
3629
`github.com/aspect-build/rules_foo/releases/tag/${tag}`
3730
);
@@ -51,19 +44,12 @@ describe("sendRequest", () => {
5144
const bcr = new Repository("bazel-central-registry", "bazelbuild");
5245
const branch = "branch_with_entry";
5346
const tag = "v1.0.0";
54-
const releaser = {
55-
name: "Json Bearded",
56-
username: "json",
57-
58-
};
5947

6048
await publishEntryService.sendRequest(
6149
tag,
6250
bcrFork,
6351
bcr,
6452
branch,
65-
releaser,
66-
[],
6753
"rules_foo",
6854
`github.com/aspect-build/rules_foo/releases/tag/${tag}`
6955
);
@@ -86,56 +72,17 @@ describe("sendRequest", () => {
8672
);
8773
});
8874

89-
test("tags the releaser in the body", async () => {
90-
const bcrFork = new Repository("bazel-central-registry", "bar");
91-
const bcr = new Repository("bazel-central-registry", "bazelbuild");
92-
const branch = "branch_with_entry";
93-
const tag = "v1.0.0";
94-
const releaser = {
95-
name: "Json Bearded",
96-
username: "json",
97-
98-
};
99-
100-
await publishEntryService.sendRequest(
101-
tag,
102-
bcrFork,
103-
bcr,
104-
branch,
105-
releaser,
106-
[],
107-
"rules_foo",
108-
`github.com/aspect-build/rules_foo/releases/tag/${tag}`
109-
);
110-
111-
expect(mockGithubClient.createPullRequest).toHaveBeenCalledWith(
112-
expect.any(Repository),
113-
expect.any(String),
114-
expect.any(Repository),
115-
expect.any(String),
116-
expect.any(String),
117-
expect.stringContaining(`@${releaser.username}`)
118-
);
119-
});
120-
12175
test("includes the release url in the body", async () => {
12276
const bcrFork = new Repository("bazel-central-registry", "bar");
12377
const bcr = new Repository("bazel-central-registry", "bazelbuild");
12478
const branch = "branch_with_entry";
12579
const tag = "v1.0.0";
126-
const releaser = {
127-
name: "Json Bearded",
128-
username: "json",
129-
130-
};
13180

13281
await publishEntryService.sendRequest(
13382
tag,
13483
bcrFork,
13584
bcr,
13685
branch,
137-
releaser,
138-
[],
13986
"rules_foo",
14087
`github.com/aspect-build/rules_foo/releases/tag/${tag}`
14188
);
@@ -152,83 +99,11 @@ describe("sendRequest", () => {
15299
);
153100
});
154101

155-
test("tags all maintainers with github handles in the body", async () => {
156-
const bcrFork = new Repository("bazel-central-registry", "bar");
157-
const bcr = new Repository("bazel-central-registry", "bazelbuild");
158-
const branch = "branch_with_entry";
159-
const tag = "v1.0.0";
160-
const releaser = {
161-
name: "Json Bearded",
162-
username: "json",
163-
164-
};
165-
const maintainers = [
166-
{ name: "M1", github: "m1" },
167-
{ name: "M2", email: "[email protected]" },
168-
{ name: "M3", github: "m3", email: "[email protected]" },
169-
{ name: "M4" },
170-
];
171-
172-
await publishEntryService.sendRequest(
173-
tag,
174-
bcrFork,
175-
bcr,
176-
branch,
177-
releaser,
178-
maintainers,
179-
"rules_foo",
180-
`github.com/aspect-build/rules_foo/releases/tag/${tag}`
181-
);
182-
183-
const body = mockGithubClient.createPullRequest.mock.calls[0][5];
184-
expect(body.includes("@m1")).toEqual(true);
185-
expect(body.includes("@m2")).toEqual(false);
186-
expect(body.includes("@m3")).toEqual(true);
187-
expect(body.includes("@m4")).toEqual(false);
188-
});
189-
190-
test("does not double tag the release author if they are also a maintainer", async () => {
191-
const bcrFork = new Repository("bazel-central-registry", "bar");
192-
const bcr = new Repository("bazel-central-registry", "bazelbuild");
193-
const branch = "branch_with_entry";
194-
const tag = "v1.0.0";
195-
const releaser = {
196-
name: "Json Bearded",
197-
username: "json",
198-
199-
};
200-
const maintainers = [
201-
{ name: "M1", github: "m1" },
202-
{ name: releaser.name, github: releaser.username },
203-
];
204-
205-
await publishEntryService.sendRequest(
206-
tag,
207-
bcrFork,
208-
bcr,
209-
branch,
210-
releaser,
211-
maintainers,
212-
"rules_foo",
213-
`github.com/aspect-build/rules_foo/releases/tag/${tag}`
214-
);
215-
216-
const body = mockGithubClient.createPullRequest.mock.calls[0][5];
217-
expect(
218-
(body.match(new RegExp(`@${releaser.username}`, "gm")) || []).length
219-
).toEqual(1);
220-
});
221-
222-
test("creates the created pull request number", async () => {
102+
test("returns the created pull request number", async () => {
223103
const bcrFork = new Repository("bazel-central-registry", "bar");
224104
const bcr = new Repository("bazel-central-registry", "bazelbuild");
225105
const branch = "branch_with_entry";
226106
const tag = "v1.0.0";
227-
const releaser = {
228-
name: "Json Bearded",
229-
username: "json",
230-
231-
};
232107

233108
mockGithubClient.createPullRequest.mockResolvedValueOnce(4);
234109

@@ -237,8 +112,6 @@ describe("sendRequest", () => {
237112
bcrFork,
238113
bcr,
239114
branch,
240-
releaser,
241-
[],
242115
"rules_foo",
243116
`github.com/aspect-build/rules_foo/releases/tag/${tag}`
244117
);

src/domain/publish-entry.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { GitHubClient } from "../infrastructure/github.js";
2-
import { Maintainer } from "./metadata-file.js";
32
import { Repository } from "./repository.js";
43
import { RulesetRepository } from "./ruleset-repository.js";
5-
import { User } from "./user.js";
64

75
export class PublishEntryService {
86
constructor(private readonly githubClient: GitHubClient) {}
@@ -12,19 +10,11 @@ export class PublishEntryService {
1210
bcrForkRepo: Repository,
1311
bcr: Repository,
1412
branch: string,
15-
releaser: User,
16-
maintainers: ReadonlyArray<Maintainer>,
1713
moduleName: string,
1814
releaseUrl: string
1915
): Promise<number> {
2016
const version = RulesetRepository.getVersionFromTag(tag);
2117

22-
// Only tag maintainers that have a github handle, which is optional:
23-
// See: https://docs.google.com/document/d/1moQfNcEIttsk6vYanNKIy3ZuK53hQUFq1b1r0rmsYVg/edit#bookmark=id.1i90c6c14zvx
24-
const maintainersToTag = maintainers
25-
.filter((m) => !!m.github && m.github !== releaser.username)
26-
.map((m) => `@${m.github}`);
27-
2818
const pr = await this.githubClient.createPullRequest(
2919
bcrForkRepo,
3020
branch,
@@ -34,10 +24,6 @@ export class PublishEntryService {
3424
`\
3525
Release: ${releaseUrl}
3626
37-
Author: @${releaser.username}
38-
39-
${maintainersToTag.length > 0 ? "fyi: " + maintainersToTag.join(", ") : ""}
40-
4127
_Automated by [Publish to BCR](https://github.com/apps/publish-to-bcr)_`
4228
);
4329

templates/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ For more information about the files that make up a BCR entry, see the [Bzlmod U
1414
Insert your ruleset's homepage and fill out the list of maintainers. Replace `OWNER/REPO` with your repository's
1515
canonical name. Leave `versions` alone as this will be filled automatically.
1616

17-
_Note_: Maintainers will be emailed if any releases fail and will be tagged on the BCR pull request.
17+
_Note_: Maintainers will be emailed if a release fails.
1818

1919
```jsonc
2020
{

0 commit comments

Comments
 (0)