Fixes T4736. Currently, we incorrectly skip the writeImportStatusFlag() call if publishing is disabled (the herald-disabled) check. This means we don't flag the commit as imported, and don't move the pipeline forward correctly.
Instead, we only want to skip the owners stuff, not the pipeline stuff. Move that to a method.
(Also fix a nearby TODO now that we have a permanent failure exception.)