Creating Your First Workflow
00:00 In this lesson, you’ll create your first GitHub workflow. You’ll start small, and then over the next few lessons, you’ll enhance it with more functionality.
00:09 Before you create your first workflow, have a look at the GitHub Actions page of your repository.
00:16 If you haven’t added any workflows, you’ll see some suggested workflows for your repository for deployments and continuous integration, and so on. Feel free to pause this video and investigate some of them by clicking Configure,
00:31 but please don’t add any of the configurations to your project yet. We want to create the workflows from scratch in this course and by this course, I mean now. Hop over to your editor.
00:44 I’m using VS Code, but of course you can use any other editor of your choice. One convenient thing about VS Code, though, is that it’s tightly coupled with GitHub.
00:55
You are welcome. GitHub workflows are based on YAML files with a predefined structure. You can choose any descriptive name you want for the file, however, it must live in a specific folder inside your project, specifically in .github/workflows
.
01:14
In the spirit of greeting the world, I name my file, hello
_world.yaml
. And now before adding any content, let’s commit this empty file and see how GitHub reacts. Save the file, stage it, and add a commit message, and then push it to GitHub.
01:40 Now, visit your remote repository in the browser and click the Actions tab again.
01:47 Instead of seeing the overview of proposed GitHub workflows, now you see a failed workflow run. I know failure never feels great, and these little red icons can be scary, but what you’re seeing here is actually good news.
02:04
Although the run failed, GitHub recognized your workflow file and tried to run it. If you click on the name of the workflow, which is the commit message, you can see the actual error and it says, No event triggers defined in on
.
02:20
In other words, GitHub wanted to run the workflow, but can’t do it without some events that you need to define in some on
section of your file.
02:30 Fair enough. If GitHub wants to be triggered, let’s trigger it.
Become a Member to join the conversation.