(pullRequest: PullRequestFromGithub)
| 22 | |
| 23 | class Validation extends PullRequestValidation { |
| 24 | assert(pullRequest: PullRequestFromGithub) { |
| 25 | const {combinedStatus, statuses} = getStatusesForPullRequest(pullRequest); |
| 26 | |
| 27 | // TODO(josephperrott): Find a way to not need to do this kind of detection. |
| 28 | // Because its not possible to determine if workflow is pending approval or if all checks and |
| 29 | // statuses have run, we use the `CI / lint (pull_request)` as a marker for if the expected |
| 30 | // checks have run already. If they have not yet run, we mark the combined status as missing. |
| 31 | if (statuses.find((status) => status.name === 'lint') === undefined) { |
| 32 | throw this._createError( |
| 33 | 'Pull request is missing expected status checks. Check the pull request for pending workflows', |
| 34 | false, |
| 35 | ); |
| 36 | } |
| 37 | if (combinedStatus === PullRequestStatus.PENDING) { |
| 38 | throw this._createError('Pull request has pending status checks.', false); |
| 39 | } |
| 40 | if (combinedStatus === PullRequestStatus.FAILING) { |
| 41 | throw this._createError('Pull request has failing status checks.'); |
| 42 | } |
| 43 | } |
| 44 | } |
nothing calls this directly
no test coverage detected