What is GitHub Actions?
Have you heard of GitHub Actions but assumed it was too complicated to learn? I had the same thought — until I u...
For further actions, you may consider blocking this person and/or reporting abuse
I was about to write an article on this but you beat me to it haha.
Love the article. Well written and straight to the point! I am trying to see if I can use GitHub Actions creatively as my CI/CD workflow. It's going well so far and a very convenient tool that everyone should use.
Well done Julie!
Thank you!😄 I'm glad you like it. Having tried to learn it twice, I might have a better sense of where beginners feel lost. 😄
I'd love to hear how you use GitHub Actions in your workflow.
I'd make missing lockfiles optional without making a failed npm ci optional. The final || true makes both cases look successful to the runner, so a broken dependency install can reach the Hugo build. An explicit if around lockfile presence keeps the beginner-friendly skip, while allowing a real install error to stop the job. I'd test it once with a deliberately invalid lockfile to check that distinction in the Actions log.
Thank you for pointing this out! 😄
To be honest, the AI agent wrote the
.ymlworkflow file for me when I was setting up my Hugo site. To ensure the run stops whennpm cifails, the AI agent suggested the following change:But it seems that the starter template on GitHub provides the same code as in the article, so I'm wondering whether the change is necessary.
Yes, I'd keep your explicit
if. You're right that GitHub's Hugo starter currently uses the same|| trueform, so this isn't something your AI invented.The difference is failure policy: that one-liner turns both "no lockfile" and "npm ci failed" into success. Your version skips only the first case. With Actions' standard Ubuntu shell behavior, a failed
npm ciin thatthenbranch stops the step; addingshell: bashmakes the shell choice explicit.The right policy depends on the site: if the theme needs Node dependencies, hiding an install error can produce an incomplete build. If the site needs no Node dependencies, skipping is fine. If they are required, even a missing lockfile should fail rather than skip. I'd check three cases: no lockfile, a valid install, and a deliberately broken install. Only the last should fail under your optional-install policy.
Thank you for the clear explanation!
This is a great explanation. I think GitHub Actions can seem pretty intimidating when you're first getting started with them. I know I felt that way at first. There's all this YAML, unfamiliar terminology, and workflows that look way more complicated than they actually are once you understand what's happening.
I really like how you broke everything down into manageable pieces, especially the simple example people can try for themselves. I think this will help a lot of people who have been curious about GitHub Actions but weren't quite sure where to start. Great post, Julie!
Thank you very much, Jessica! 😄Glad you like it.
It resonated with me when you described the feeling of learning something new. Truth be told, this is my second attempt at learning GitHub Actions. The first time, I felt exactly what you described: I didn't understand the tutorials, felt frustrated, and eventually gave up.
This time, with the help of AI, I learned by doing. As you said, when we get started and work through the process, we'll find it's not as hard as we imagined. Perhaps this experience has helped me understand where beginners struggle, since I've been through this process myself.
The six-line hello workflow is a good starting point because you can see the trigger and the job without deployment details getting in the way. For the Hugo example, what would you add next to handle a scheduled build overlapping with a push-triggered deployment?
Thank you! As for adding scheduling, I wrote a post about it. Feel free to take a look.😄
The
scheduleandpushevents trigger the workflow independently: one at the scheduled time, the other on every push.Thanks, Julie. That clears up the distinction: the schedule doesn't replace the push trigger. Showing both runs side by side would make a useful follow-up exercise for beginners. Appreciate the explanation and the link!
You're welcome! 😄 Yes, the
schedule,push, andworkflow_dispatchtriggers don't replace one other. Each servers a different purpose.This is exactly the setup I wish more beginners started with. Small, real, and it solves an actual annoyance instead of a tutorial problem. One thing I learned the hard way though. The day an Actions workflow silently fails is the day you realise nobody checks the Actions tab until a post is missing. I now tell people to turn on the failure emails from day one. Do you also deploy through Actions, or does it only build and something else puts the site live?
Thanks, Ali! Glad you like it. 😄 My GitHub Actions workflow handles both the build and deployment, so all I need to do is push a new post to the GitHub repository each time.
As for email notifications, I sometimes get emails telling me that Actions have failed. That's useful, especially for scheduled Actions. Your suggestion to enable notifications from the start is a good one.
Clear explanations! I am fairly recently using GitHub actions in my portfolio projects as well and I'm kinda liking it because of it's straightforward approach.
Thank you! 😄Yes, once you start using GitHub Actions, you'll find it convenient because it can automate many tasks.
What do you use GitHub Actions for in your portfolio projects?😄
Mainly for linting, building prod, and running tests for CI.