'How to automatically override a merge request to edit a file and continue the request?

I'm looking for a solution to automatically change somes files before my ci-cd (gitlab-ci.yaml) start running and to make this change persistant in the code version.

This is to prevent some developers from forgetting to update certain files.

Actually, I've create a job in my CI-CD which will push the update and skip ci-cd to avoid infinity loop. It's not very beautiful and I need to duplicate that to keep updated all the jobs (because they will not take this push into account).

Execution schema :

1 - Devs commit / push their work.
2 - Devs do a merge request.
3 - ** my dreamed solution ** : Gitlab detect the MR and run my custom script to override the MR before CI-CD.
4 - Gitlab continue the MR process and launch gitlab-ci.yml for example.

(Note that, my devs make MR from gitlab website).
Is something similar exist ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source