Fixing ClassCastException when using workflow plugin

Workflow jobs are not using the `AbstractBuild` layer of Jenkins so
the `RebuildActionFactory` cannot be used.