Skip to content

Commit

Permalink
Add Fixes N/A as an option to Pr description validation (#6704)
Browse files Browse the repository at this point in the history
  • Loading branch information
penalosa authored Sep 16, 2024
1 parent daea5e9 commit 9442ec7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
34 changes: 33 additions & 1 deletion tools/deployments/__tests__/validate-pr-description.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Fixes #[insert GH or internal issue number(s)].
)
).toMatchInlineSnapshot(`
[
"Your PR description must include an issue reference in the format \`Fixes #000\` (for GitHub issues) or \`Fixes [AA-000](https://jira.cfdata.org/browse/AA-000)\` (for internal Jira ticket references)",
"Your PR description must include an issue reference in the format \`Fixes #000\` (for GitHub issues), \`Fixes [AA-000](https://jira.cfdata.org/browse/AA-000)\` (for internal Jira ticket references), or \`Fixes N/A\` if there's no associated issue (and it doesn't make sense to create one)",
"All TODO checkboxes in your PR description must be unchecked before merging",
"Your PR must include tests, or provide justification for why no tests are required",
"Your PR must run E2E tests, or provide justification for why running them is not required",
Expand Down Expand Up @@ -89,6 +89,38 @@ Fixes [AA-000](https://jira.cfdata.org/browse/AA-000).
## Author has addressed the following
- Tests
- [ ] TODO (before merge)
- [ ] Tests included
- [x] Tests not necessary because: test
- E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
- [ ] I don't know
- [ ] Required
- [x] Not required because: test
- Changeset ([Changeset guidelines](https://github.com/cloudflare/workers-sdk/blob/main/CONTRIBUTING.md#changesets))
- [ ] TODO (before merge)
- [ ] Changeset included
- [x] Changeset not necessary because: test
- Public documentation
- [ ] TODO (before merge)
- [ ] Cloudflare docs PR(s): <!--e.g. <https://github.com/cloudflare/cloudflare-docs/pull/>...-->
- [x] Documentation not necessary because: test
`,
"[]"
)
).toMatchInlineSnapshot(`[]`);
});

it("should accept N/A issue reference", () => {
expect(
validateDescription(
"",
`## What this PR solves / how to test
Fixes N/A.
## Author has addressed the following
- Tests
- [ ] TODO (before merge)
- [ ] Tests included
Expand Down
6 changes: 3 additions & 3 deletions tools/deployments/validate-pr-description.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ export function validateDescription(
}

if (
!/^Fixes (#\d+|\[[A-Z]+-\d+\]\(https:\/\/jira\.cfdata\.org\/browse\/[A-Z]+-\d+\))/m.test(
!/^Fixes (#\d+|N\/A|\[[A-Z]+-\d+\]\(https:\/\/jira\.cfdata\.org\/browse\/[A-Z]+-\d+\))/m.test(
body
)
) {
errors.push(
"Your PR description must include an issue reference in the format `Fixes #000` (for GitHub issues) or `Fixes [AA-000](https://jira.cfdata.org/browse/AA-000)` (for internal Jira ticket references)"
"Your PR description must include an issue reference in the format `Fixes #000` (for GitHub issues), `Fixes [AA-000](https://jira.cfdata.org/browse/AA-000)` (for internal Jira ticket references), or `Fixes N/A` if there's no associated issue (and it doesn't make sense to create one)"
);
}

Expand Down Expand Up @@ -94,7 +94,7 @@ export function validateDescription(

if (
!(
/- \[x\] Cloudflare docs PR\(s\): https:\/\/github\.com\/cloudflare\/cloudflare-docs\/(pull|issue)\/\d+/.test(
/- \[x\] Cloudflare docs PR\(s\): https:\/\/github\.com\/cloudflare\/cloudflare-docs\/(pull|issues)\/\d+/.test(
body
) || /- \[x\] Documentation not necessary because: .+/.test(body)
)
Expand Down

0 comments on commit 9442ec7

Please sign in to comment.