Use a Custom Github Action to Log Hello World in Another Project

Colby Fayock
InstructorColby Fayock
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 4 years ago

In this lesson, you'll learn how to use a newly created custom Github Action in a separate Github repository. We'll walk through configuring a new workflow, how to find the configuration details of your new Action, and successfully run it on a project.

Colby Fayock: [0:00] We're going to start off with a new custom GitHub Action that logs Hello World. After we create this Action, we want to make sure it works when somebody uses it. I created this new GitHub repository to test it out.

[0:09] To get started, we're going to navigate over to the Actions tab. Once there, we're going to set up the workflow ourself. Once there, we can make a few updates. We can rename it to hello-world, set the name to Hello World, and we can remove some of these other comments for now.

[0:23] We also don't need any other steps other than our own, so we're going to remove everything in the steps that are being used so far.

[0:28] Instead, we're going to set up our own uses. For the uses value, we want to use the repository name. We can go ahead and copy that from the page of the original Action, and we can paste it as our uses.

[0:38] The last thing we want to add is a reference to the branch or tag. While we can do something like master which references the master branch, we already created some tags, which particularly we have v1..1. Instead of master, let's use that tag v1..1.

[0:54] Once we're good, we can go ahead and Start and Commit that straight to master. Once that's committed, it'll immediately kick off the job.

[1:00] Finally, once it's finished, we can see our action, and we can see a log Hello, world.

[1:05] In review, we have a custom GitHub Action that we wanted to test in a different repository. To do this, we were able to create a workflow file in a separate repository, and inside that, we referenced our GitHub Action.

[1:15] We also used the tag so we can reference a specific version. Once that was committed, it kicked off a job, and it used our Action to log Hello, world.