Parfuemerie-Douglas / scaffolder-backend-module-azure-repositories

A collection of Backstage scaffolder backend modules for Azure repositories.
https://www.npmjs.com/package/@parfuemerie-douglas/scaffolder-backend-module-azure-repositories
Apache License 2.0
10 stars 23 forks source link

Azure Clone Repo unable to checkout to branch other than master #33

Closed GDivino closed 1 month ago

GDivino commented 3 months ago

Problem

While trying to clone a repo using the azure:repo:clone action, I noticed that I am not able to use the branch input successfully (unless we specify the default branch).

Code

id: cloneRepo
name: Clone Azure Repo
action: azure:repo:clone
input:
  remoteUrl: ...
  branch: new-branch
  targetPath: ./new-folder

Error message

2024-06-12T14:11:59.000Z info: Creating new remote...
2024-06-12T14:11:59.000Z info: Checking out branch...
2024-06-12T14:11:59.000Z NotFoundError: Could not find origin/new-branch

For some reason, only using master works. Is this perhaps because the code clones the repository with only the default branch?

Anyone experienced the same issue and have workarounds to this?

GDivino commented 3 months ago

Bumping this, any leads or advice would be a huge help :(

GDivino commented 3 months ago

I solved this by diving deep into the code, and found out that git.checkout is not working properly for some reason. I decided to use the clone function instead when specifying the branch, and this worked for me.

I will create a PR for this.