Member-only story
Fundamentals of GitHub Actions
Confidently create workflow files in your GitHub repository

Introduction
I’ve only recently dived into GitHub Actions and I’m amazed at what it can do. To put it simply, GitHub Actions helps you create workflows — this is not limited to a CI/CD pipeline, you can also create various automation tasks like automatically labelling issues when they’re created, linting code with every pull request, notifying a Slack channel when a package is updated in the GitHub registry— and all of this is done within the GitHub code repository itself.
In this article, we’ll have a look at the fundamental components of GitHub Actions so you may feel confident using them in your repositories.
How to edit an action file?
Before you begin, it’s important to get your toolkit ready. I would highly recommend using VS Code to edit your GitHub Actions workflow file. Additionally, installing this VS Code extension provides IntelliSense and real-time code linting.
Now that that’s out of the way, let’s begin.
Creating, storing and naming
You can create a GitHub Actions workflow file by adding a YAML file in the .github/workflows
directory of your repository. You can either have a single workflow file in this directory or multiple workflow files. Each workflow will run depending on the trigger event you’ve configured.
Your GitHub Actions workflow file can be named anything you like, although, I wouldn’t recommend naming it action.yml
. Here’s why — when creating your own custom action for others to use, you need to supply a metadata file that has to be named action.yml
(or action.yaml
) and has a slightly different syntax than regular workflow files. The VS Code extension linked above validates the syntax of this metadata file if the file is named action.yml
(or .yaml
). Hence, to avoid code linting conflicts, it's best to give your workflow file another name.
You would’ve noticed, I’ve used two different YAML file extensions above. That’s because both of them are valid filenames, i.e, build.yml
and build.yaml
are both correct.
While we’re on the topic of naming, the name
keyword in the YAML file is used to…