Follow-up from "Consolidate `trigger-build-docs` into `trigger-build`"
The following discussion from !37082 should be addressed:
- [ ] @ashmckenzie started a [discussion](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37082#note_384150521):
> question: I know this logic existed previously like this, but couldn't this be an infinite loop? Could we have a maximum wait time, just in case, e.g.
>
> ```suggestion:-0+0
> MAX_WAIT_TIME.times do
> ```
>
> Where `MAX_WAIT_TIME` is `MAX_WAIT_TIME = 60` or such and then raise exception if `pipeline` is `nil`?
cc @rymai
issue