I am using gitlab CI runner to test my code and generating some files. I just want to push the generated files to gitlab repository via CI runner. Is there any way to do that ?
I have resolved this issue by doing this :
User Settings > Access Tokens
Your project > Settings > Secret variable
-> edit : If you want to git push to a non protected branch do not set the runner variable as protected
Then you can use this token instead of the default in you gitlab-ci script. for example :
before_script:
- git remote set-url origin https://USERNAME:${CI_PUSH_TOKEN}@gitlab.com/your-project.git
- git config --global user.email '[email protected]'
- git config --global user.name 'yourname'
...
- git checkout -B branch
- change files
- git commit -m '[skip ci] commit from CI runner'
- git push --follow-tags origin branch