Happy new month guys, so I needed an automated way of creating repositories in Github. From what I saw, they were two extra options apart from creating it manually in your browser. And the two other options are:-
- Using the Github API
- Controlling your browser like a puppet master (puppet bender)
I ended up using the second option. So the good thing about node is that it has supported modules for browser automation. And among the modules I saw, I decided to go with Puppeteer.
Puppeteer is a node.js library that provides you with a high-level API that gives you control over headless chrome or chromium. It can also run chrome in a non-headless mode(full UI)
What I mean by headless mode is that your browser runs but without the user interface.
Puppeteer is well built and gives you lots of control over chrome or chromium using its wide range of supported API features.
In writing the code I also took into account the fact that two-factor authentication might be required, so when that happens you would be prompted to insert your OTP in the terminal and once you click on enter the process resumes.
You can check out the link to my repo here.
Using Puppeteer to generate a link for your new repo isn’t faster than using the available Github API. I just wanted to try it out and see how cool it would be.
Puppeteer can also be used for scraping and test automation. If you have cool ideas regarding puppeteer feel free to drop it down in the comment section below.
And again the link to the repo is this