Workflow actions are not removed in target environment.

Workflow actions cannot be removed from a specific workflow rule when deploying with the Metadata API. This means that if you try to replace a workflow action in the target environment with a different one for a specific workflow rule, the Metadata API will add the new workflow action without removing the existing one. This will happen if you use Copado, Workbench , ANT or any other deployment tool based on the Metadata API.

Suppose you have a the Workflow Rule with an Email Alert like the one below:

User-added image

If you deploy into that org the xml file below, the "Email Alert 2" will be added instead of replacing the "Email Alert 1". This will happen even if the "Email Alert 1" is not specified in the xml file you are deploying.

User-added image

The result of the deployment in the target org will be this:

User-added image

The workaround will be to delete the "Email Alert 1" in the target environment manually. You can set a manual task in the deployment to to remind the developer that the workflow action must be removed manually in the target environment. The Metadata API is doing the retrieve properly therefore the workflow files in git will be updated with the right workflow actions what means that you do not have to worry about making any changes in the repository.

How did we do?