Skip to content

Commit 7b901c7

Browse files
committed
refactor(ng-dev): move checking if the pull request is a draft into the merge ready check (#2899)
The merge ready check is a more logical place for this check to occur PR Close #2899
1 parent 1be5b0e commit 7b901c7

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
@@ -59886,6 +59886,9 @@ async function pullRequestHasValidTestedComment(comments, gitClient) {
5988659886
var mergeReadyValidation = createPullRequestValidation({ name: "assertMergeReady", canBeForceIgnored: false }, () => Validation7);
5988759887
var Validation7 = class extends PullRequestValidation {
5988859888
assert(pullRequest) {
59889+
if (pullRequest.isDraft) {
59890+
throw this._createError("Pull request is still a draft.");
59891+
}
5988959892
if (!pullRequest.labels.nodes.some(({ name }) => name === actionLabels.ACTION_MERGE.name)) {
5989059893
throw this._createError("Pull request is not marked as merge ready.");
5989159894
}
@@ -59924,9 +59927,6 @@ var Validation9 = class extends PullRequestValidation {
5992459927
var pendingStateValidation = createPullRequestValidation({ name: "assertPending", canBeForceIgnored: false }, () => Validation10);
5992559928
var Validation10 = class extends PullRequestValidation {
5992659929
assert(pullRequest) {
59927-
if (pullRequest.isDraft) {
59928-
throw this._createError("Pull request is still a draft.");
59929-
}
5993059930
switch (pullRequest.state) {
5993159931
case "CLOSED":
5993259932
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)