Skip to content

Commit b0695c4

Browse files
committed
refactor(ng-dev): move checking if the pull request is a draft into the merge ready check
The merge ready check is a more logical place for this check to occur
1 parent ae6afbc commit b0695c4

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

.github/local-actions/branch-manager/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59873,6 +59873,9 @@ async function pullRequestHasValidTestedComment(comments, gitClient) {
5987359873
var mergeReadyValidation = createPullRequestValidation({ name: "assertMergeReady", canBeForceIgnored: false }, () => Validation7);
5987459874
var Validation7 = class extends PullRequestValidation {
5987559875
assert(pullRequest) {
59876+
if (pullRequest.isDraft) {
59877+
throw this._createError("Pull request is still a draft.");
59878+
}
5987659879
if (!pullRequest.labels.nodes.some(({ name }) => name === actionLabels.ACTION_MERGE.name)) {
5987759880
throw this._createError("Pull request is not marked as merge ready.");
5987859881
}
@@ -59911,9 +59914,6 @@ var Validation9 = class extends PullRequestValidation {
5991159914
var pendingStateValidation = createPullRequestValidation({ name: "assertPending", canBeForceIgnored: false }, () => Validation10);
5991259915
var Validation10 = class extends PullRequestValidation {
5991359916
assert(pullRequest) {
59914-
if (pullRequest.isDraft) {
59915-
throw this._createError("Pull request is still a draft.");
59916-
}
5991759917
switch (pullRequest.state) {
5991859918
case "CLOSED":
5991959919
throw this._createError("Pull request is already closed.");

ng-dev/pr/common/validation/assert-merge-ready.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export const mergeReadyValidation = createPullRequestValidation(
1919

2020
class Validation extends PullRequestValidation {
2121
assert(pullRequest: PullRequestFromGithub) {
22+
if (pullRequest.isDraft) {
23+
throw this._createError('Pull request is still a draft.');
24+
}
2225
if (!pullRequest.labels.nodes.some(({name}) => name === actionLabels.ACTION_MERGE.name)) {
2326
throw this._createError('Pull request is not marked as merge ready.');
2427
}

ng-dev/pr/common/validation/assert-pending.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ export const pendingStateValidation = createPullRequestValidation(
1818

1919
class Validation extends PullRequestValidation {
2020
assert(pullRequest: PullRequestFromGithub) {
21-
if (pullRequest.isDraft) {
22-
throw this._createError('Pull request is still a draft.');
23-
}
2421
switch (pullRequest.state) {
2522
case 'CLOSED':
2623
throw this._createError('Pull request is already closed.');

0 commit comments

Comments
 (0)