Moving sources between remote branches through Gitlab CI runner

Hi Everyone,

I have fourbranches:

  1. dev
  2. hotfix
  3. staging
  4. master

Scenario is like this; after feature branches are merged into dev branch pipeline’s jobs are triggered such as building, testing and than branching.

Application is being developed on dotnet core, building and testing it simple because I am just running dotnet build and dotnet test.

on branching i have two jobs:

  1. on_failure the failed version of sources in dev branch must be moved in hotfix
  2. on_success the successful version of sources must be moved into staging branch

Is it possible to do so in a shell script during the execution of the pipeline ?

I have already created an impersonated user, I have also setup the ssh key and the private token as well.

below you can see a screenshot of the pipeline and also the gitlab-ci.yml


Thank you.