Have you tried GitHub Actions? In this episode, we talk about experimenting with GitHub Actions and why YAML will be the programming language of the future. You’ll hear what GitHub Actions is and how it works, using the example of the creation of a pull request. We discuss other things that GitHub Actions can do and the biggest problem we’ve run into with it when it comes to testing. This episode is full of insights and practical advice for anyone looking to get started with GitHub Actions. Tune in to find out more!
[INTRODUCTION]
[0:00:01.9] MN: Hello and welcome to The Rabbit Hole, the definitive developer’s podcast. Living large in New York, I’m your host, Michael Nuñez, and today, we’re talking about working with GitHub Actions.
[DISCUSSION]
[0:00:14.8] MN: I just came from a client recently and had the opportunity to work with GitHub Actions. I mean, I wanted to do a recording just to get something out of my brain and into some medium, and going to choose the podcast to do it.
So if you're an expert on GitHub Actions, please reach out to me @radiofreerabbit or @GoogleMike on Twitter and I would love to be able to chat some more about some of the infrastructure stuff that could be done on GitHub Actions.
As you know, I’m a software developer, a software engineer but got the opportunity to do some, you know, infra-related stuff, nothing too intense but I will say that it was a lot of fun. I know that the future— if computers or rather, if AI isn’t going to write the code for us, one thing I do know for sure is that we will be programming in YAML, right? So let’s just get that out of the way.
What is GitHub Actions? GitHub Actions is a tool that allows you to run and automate certain jobs or scripts at any given point in time depending on like how you write your action to run in the first place.
[0:01:36.0] So I’ll try to use some of the examples that I’ve done previously and see if I can make sense into what is currently how GitHub Action works. So again, you have to write everything in YAML and there are many different ways that you can, your actions can run something.
So an example that I had to do, or that I used, was you know, on the creation of pull request, the very, very light. You know, we wanted to just make sure that the JSON files that were being used were linted properly and it was great because you could just have on a pull request. You can run it, you know, using any container, any docker container, which I think is pretty dope and you can use any of the images that exist on Docker hub if I got that correctly. Yeah, if you got a hub.docker.com, you can use any one of those images.
If you wanted to search for a given image to have it do a certain thing, you can do that. My example, I used an image that had both Python and Note 16 installed already, which was pretty cool.
[0:02:47.0] But you can just even go as far as doing it in Ubuntu latest. That’s just like a value you can put in, which I think is pretty dope.
And then from there, you can have it run your scripts automated. So you can say like, “Oh, install prettier and then run this prettier script” and then you know, make sure, line by line, you can have it do a certain, you know, whatever you wanted to do on a given pull request.
And then, any given GitHub Action, you can make sure that if one action depends on the other, you don’t start the next action until the previous one is finished. All sorts of really, really cool stuff.
I felt like it was really easier for me to dive in and start creating my actions a lot better than you know, something like Jenkins, and the documentation for GitHub Actions were like, on point, pretty amazing stuff. And you can have it pretty much do any and all the things.
[0:03:49.8] I imagine even on deployment, I had another action that I needed to create when you merge or push into main to have it run certain updates, certain configurations on merge, and stuff like that, your GitHub Action has the ability to, you know, go ahead and do that.
So you know, you could run your script, you can have your image install the AWS CLI to then run any AWS CLI command. That will allow you to upload a file or pull files down if you needed to, anything of that nature but the fact that you can just spin this up was pretty nifty.
The only issue that I ran into with GitHub Actions right now was you know, “How do I test and how do I actually see if my actions were doing the right thing?” and what I had to do was essentially create a pull request and then make my actions based on the updatable pull request or a creation of a pull request. And I found that I triggered way too many events at the same time over and over and over again, which was pretty annoying at one point because then I had like a hundred failed builds because I was just making the change, pushing up, that kind of thing.
[0:05:04.3] So testing was a little bit weird for me. I’ve seen people who use push as an action that you would then run your scripts on. I feel like that’s a bit too extreme, that’s why I kept it at pull request because you can just test it on that very same pull request to ensure that things are working just fine.
I imagine that there is an easier way to do that but I didn’t find a way to get started. But there is a – if you want to just play around, I think you can just start using GitHub Actions. It’s really, really quick with a very, very simple PR that you can do or on push if you really wanted to test it.
All you really had to do is in your GitHub repository, create a folder. I mean yeah, in your project, you create a folder called, where it’s .GitHub/workflows and then any YAML file that you create in there will be a job that will run. And then you can – There are all sorts of different, again, different actions and events that you can have your GitHub action run on. And if you really wanted to test, you can just go straight up on a push. So if you push up it will run this thing, run your action.
[0:06:20.1] And definitely Google, if you google “GitHub Action quick start”, that will give you like a five-minute tutorial on how to have your GitHub Actions do things. But you know, it really looked like the sky was the limit here, and all the many different things that you can use and create.
Lastly, I know that they have like a – not like an app store but there’s like a GitHub Actions marketplace, where you can, you know depending on the thing that you want to run that might have been someone who already create something of that nature. So you don’t have to rewrite it, you can just import that given GitHub action and then run it with whenever you want that to run depending on the event and makes life a little easier and you don’t have to rewrite any code if it already exists out there.
I’m going to be looking into you know, converting all my infrastructure automated tools to start using GitHub Actions, so hopefully, I can come back with an update on own GitHub Actions and how it worked out for me.
But if you have any experience with GitHub Actions, I’d love to be able to sync up with you and talk more about it because I felt like it was really easy to get on, onboard, and do but I know that there is a world that I do not see in how GitHub Actions will change everyone’s life for the better.
[END OF DISCUSSION]
[0:07:46.1] MN: Follow us now on Twitter @radiofreerabbit so we can keep the conversation going. Like what you hear? Give us a five-star review and help developers just like you find their way into The Rabbit Hole and never miss an episode, subscribe now however you listen to your favorite podcast. On behalf of our producer extraordinaire, William Jeffries, and my amazing co-host, Dave Anderson, and me, your host, Michael Nuñez, thanks for listening to The Rabbit Hole.
[END]