Github Actions by Example
  • GitHub Actions by Example
  • chap1-intro
    • Section 1 - Introducing GitHub Actions
    • Section 2 - Terminology and Core Concepts
    • Section 3 - Building a workflow
  • chap2-deployment-workflow
    • Section 1 - Workflow
    • Section 2 - The services
    • Section 3 - The test workflow job
    • Section 4 - The build and push workflow job
    • Section 5 - The deploy workflow job
  • Chap3-reusable-workflows
    • Section 1 - What is a reusable workflow
    • Section 2 - The test reusable workflow
    • Section 3 - The build and push reusable workflow
    • Section 4 - The deploy reusable workflow
    • Section 5 - Releasing the reusable workflow
  • Chap4-custom-actions
    • Section 1 - What is a custom action
    • Section 2 - Composite Custom Actions
    • Section 3 - Javascript Custom Actions
Powered by GitBook
On this page
  1. Chap4-custom-actions

Section 1 - What is a custom action

PreviousChap4-custom-actionsNextSection 2 - Composite Custom Actions

Last updated 7 months ago

Throughout the workflow examples we’ve covered so far, we’ve been using custom actions. In GitHub Actions, each step in a workflow either calls a custom action or executes shell commands (such as bash). We’ve been leveraging custom actions shared by the GitHub community to build our workflows efficiently.

One custom action that we’ve used in every single workflow so far is the . This is a custom JavaScript action developed and maintained by GitHub Actions, and it’s responsible for checking out your repository’s code so that subsequent workflow steps can interact with it.

There are three types of custom actions:

  1. Docker container actions

  2. JavaScript actions

  3. Composite actions

In this chapter, we’ll focus on JavaScript actions and composite actions, explaining how they work and how you can create and use them in your own workflows.

The get-labels custom action

In the previous examples, we’ve used the , particularly in Chapter 1, Section 3: Building a Workflow, where we built the release workflow for the get-labels action. We’ve also utilized this action in every release workflow we’ve covered. The purpose of this action is to read a label from a pull request and determine what kind of release to perform—whether it’s a patch, minor, or major release.

In this chapter, we’ll implement the in two different ways: as a composite action and as a JavaScript action. This will give us a deeper understanding of how custom actions work and how they can be structured to suit different needs.

checkout action
get-labels action
get-labels action