I’m new to the CI thing. I have an Azure Pipeline that generates a file based on my main repository. I want to know the best way to get this generated file and Commit it to another repository (without affecting the main repository).
Basically:
[Pipeline of Main Repository] --> [Generate file] --> [Commit to secondary repository]
Important: The second repository doesn’t belong to the same organization.
I have not been able to find information on whether it is possible to clone and commit to a repository within a pipeline without affecting the main repository.
Thank you very much.
I can make it work with the following steps.
Steps:
Create an Azure Repos service connection for the Azure Repo in another organization with your Personal Access Token.
Check out multiple repositories in your pipeline. The source code is checked out into directories named after the repositories as a subfolder
$(Build.SourcesDirectory). In my sample, the self repo path is$(Build.SourcesDirectory)/selfreponame, the second repo path is$(Build.SourcesDirectory)/testrepo.Use git command to push the generated file to the second repo in the bash task.
Sample yaml:
Result :