@@ -2,7 +2,7 @@ import * as core from '@actions/core';
2
2
import { context } from '@actions/github' ;
3
3
import { Octokit , RestEndpointMethodTypes } from '@octokit/rest' ;
4
4
import { Commit , parseCommitMessage } from '../../../ng-dev/commit-message/parse.js' ;
5
- import { managedLabels , targetLabels } from '../../../ng-dev/pr/common/labels/index.js' ;
5
+ import { actionLabels , managedLabels , targetLabels } from '../../../ng-dev/pr/common/labels/index.js' ;
6
6
import { ANGULAR_ROBOT , getAuthTokenFor , revokeActiveInstallationToken } from '../../utils.js' ;
7
7
import { ManagedRepositories } from '../../../ng-dev/pr/common/labels/base.js' ;
8
8
@@ -85,6 +85,7 @@ class PullRequestLabeling {
85
85
if ( this . pullRequestMetadata === undefined ) {
86
86
return ;
87
87
}
88
+
88
89
/** The base reference string, or target branch of the pull request. */
89
90
const baseRef = this . pullRequestMetadata . base . ref ;
90
91
@@ -100,6 +101,24 @@ class PullRequestLabeling {
100
101
await this . addLabel ( targetLabels . TARGET_FEATURE . name ) ;
101
102
}
102
103
}
104
+
105
+ if ( this . pullRequestMetadata . draft && this . labels . has ( actionLabels . ACTION_MERGE . name ) ) {
106
+ core . info ( `This pull request is still in draft mode, removing "action: merge" label` ) ;
107
+ await this . removeLabel ( actionLabels . ACTION_MERGE . name ) ;
108
+ }
109
+ }
110
+
111
+ /** Add the provided label to the pull request. */
112
+ async removeLabel ( label : string ) {
113
+ const { number : issue_number , owner, repo} = context . issue ;
114
+ try {
115
+ await this . git . issues . removeLabel ( { repo, owner, issue_number, name : label } ) ;
116
+ core . info ( `Removed ${ label } label from PR #${ issue_number } ` ) ;
117
+ this . labels . delete ( label ) ;
118
+ } catch ( err ) {
119
+ core . error ( `Failed to remove ${ label } label from PR #${ issue_number } ` ) ;
120
+ core . debug ( err as string ) ;
121
+ }
103
122
}
104
123
105
124
/** Add the provided label to the pull request. */
0 commit comments