I am experimenting with the Github REST API:
I am trying to to sequentially
create a repo from template (template has 2 branches - main and editor, content at the beginning identical) https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-using-a-template -> works fine solo
directly afterwards create an additional (parametric) file in the newly created repo (editor branch not main) https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents
It has worked some times during dev but not reliably even though the first call is correctly awaited
create a repo from template seems only to create the repo immediately but cloning the content / branches is apparently not finished, yet in any case...
I get the following error
'Branch editor not found' (editor is the 2nd branch of the cloned template)
If I add a timeout of 5000ms (randomly chosen to detect the problem) then everything runs fine..
It appears I have to check for the completion of the cloning myself? Is there a way to detect when a repo is created and completely cloned?