@@ -11,6 +11,7 @@ import {
1111} from '../../../../github-actions/utils.js' ;
1212import { MergeConflictsFatalError } from '../../../../ng-dev/pr/merge/failures.js' ;
1313import { createPullRequestValidationConfig } from '../../../../ng-dev/pr/common/validation/validation-config.js' ;
14+ import { InvalidTargetLabelError } from '../../../../ng-dev/pr/common/targeting/target-label.js' ;
1415
1516interface CommmitStatus {
1617 state : 'pending' | 'error' | 'failure' | 'success' ;
@@ -155,19 +156,22 @@ async function main() {
155156
156157 await setMergeabilityStatusOnPullRequest ( statusInfo ) ;
157158 } catch ( e : Error | unknown ) {
159+ let state : CommmitStatus [ 'state' ] = 'error' ;
158160 let description : string ;
159161 const { runId, repo, serverUrl} = actionContext ;
160162 const targetUrl = `${ serverUrl } /${ repo . owner } /${ repo . repo } /actions/runs/${ runId } ` ;
161- if ( e instanceof Error ) {
163+
164+ if ( e instanceof InvalidTargetLabelError ) {
165+ // For this action, an invalid target label represents that we aren't ready to check the
166+ // mergeability yet, rather than an actual failure.
167+ state = 'pending' ;
168+ description = e . failureMessage ;
169+ } else if ( e instanceof Error ) {
162170 description = e . message ;
163171 } else {
164172 description = 'Internal Error, see link for action log' ;
165173 }
166- await setMergeabilityStatusOnPullRequest ( {
167- state : 'error' ,
168- description,
169- targetUrl,
170- } ) ;
174+ await setMergeabilityStatusOnPullRequest ( { state, description, targetUrl} ) ;
171175 // Re-throw the error so that the action run is set as failing.
172176 throw e ;
173177 }
0 commit comments