Automation with Cypress: Renaming GitHub Repo Default Branches - a podcast by Kent C. Dodds

from 2021-01-26T20:29:28

:: ::

https://github.com/kentcdodds/rename-gh-to-main
Hello there friends. So today I'm going to talk about what I did yesterday
and that is I spent just like an hour to renaming all of the defaultbranches on my GitHub repos from Master to Maine. Now, I'm not going to
really explain directly why I actually have a article that you can go readbut Git and and GitHub are moving the default branch from master to main
fork historical reasons and you know references to slavery and that sort ofthing.
And so I decided I wanted to support that and I wanted to.Get everythingconsistent but I have over almost 300 repositories where it's the source
repository not a fork I have. Yeah, just a lot of repositories. I didn't
want to spend all the time. And as far as I know there's no GitHub API for
for updating the default branch from Master to Maine.And so I needed to use the UI. So what I did yesterday is I actually
livestream this and you can go watch it, but I used Cyprus to automatenavigating to every one of these repos. I wanted to and,Rename and we'd go
to the slash branches URL for each one of the repos and select the thelittle edit button for the default branch and then enter main as the name
and then you know rename the branch and click that button.It was actually pretty straightforward. They're just a handful of lines of
code and it's all open source you can go take a look at how it it's all set
up but it was really cool to write this really quick. Cyprus quote-unquotetest automation and and see it in the browser and what was cool is the way
that I was able.To develop it because Cypress actually pulls up a real browser and you can
interact with that browsing you can type in and because I was livestreaming I didn't want to actually have Cyprus enter in my username and
password so I was able to have it pause the execution of the test so that Icould take the browser off of the window and type in my username and
password and then have a proceed and and go through everything.So you should go take a look at that. It was like an hour and a half you
could speed it up and just skip to the parts that are interesting. Butyeah, it was pretty pretty cool and I I like using Cyprus for this sort of
thing.If you were doing like legit long-term web scraping or something,maybe puppeteer would be a better fit but Cyprus makes manual processes
like this like just so nice and easy.So yeah give that a look. It's kind of interesting and I hope that you find
it fascinating and fun and I hope you have a marvelous day. Bye.

Further episodes of 3 Minutes with Kent

Further podcasts by Kent C. Dodds

Website of Kent C. Dodds