  A consistent quantum treatment of general gauge theories with an arbitrary
gauge-fixing in the presence of soft breaking of the BRST symmetry in the
field-antifield formalism is developed. It is based on a gauged (involving a
field-dependent parameter) version of finite BRST transformations. The
prescription allows one to restore the gauge-independence of the effective
action at its extremals and therefore also that of the conventional $S$-matrix
for a theory with BRST-breaking terms being additively introduced into a
BRST-invariant action in order to achieve a consistency of the functional
integral. We demonstrate the applicability of this prescription within the
approach of functional renormalization group to the Yang--Mills and gravity
theories. The Gribov--Zwanziger action and the refined Gribov--Zwanziger action
for a many-parameter family of gauges, including the Coulomb, axial and
covariant gauges, are derived perturbatively on the basis of finite gauged BRST
transformations starting from Landau gauge. It is proved that gauge theories
with soft breaking of BRST symmetry can be made consistent if the transformed
BRST-breaking terms satisfy the same soft BRST symmetry breaking condition in
the resulting gauge as the untransformed ones in the initial gauge, and also
without this requirement.
