4 Steps to Creating a Custom GitHub Action

4 Steps to Creating a Custom GitHub Action

Create an action, test it offline, and publish it in the GitHub Action Marketplace. Automation, complexity reduction, reproducibility, and maintainability are all advantages that can be realized by a continuous integration (CI) pipeline. With GitHub Actions, you can build these CI pipelines.

Introduction

Automation, complexity reduction, reproducibility, and maintainability are all advantages that can be realized by a continuous integration (CI) pipeline. With GitHub Actions, you can build these CI pipelines.

“You can create workflows using actions defined in your repository, open-source Actions in a public repository on GitHub, or a published Docker container image.” — GitHub Docs

I recently started a new project at work where I had to implement a new CI pipeline. In this process, I had to call an API, validate the result, and pass it on. I ended up with an inline script of 20 lines within the run section. That was anything but simple, maintainable, and reusable.

After this miserable failure, I looked up how to create custom GitHub Actions. I was pleasantly surprised that it is very easy to write, test, and publish your own custom GitHub Action. It took me around one hour to research, implement, test, deploy, and release my action. You can check it out on GitHub.

Tutorial

In the following tutorial, we are going to create a custom GitHub Action in four steps. Our Action will execute a simple bash script. This bash script will call the pokeapi.co API-endpoint with a PokeDex ID as a parameter. Then we will parse the result and return the name of the Pokemon. After that, we will echo the result of our bash script in our GitHub Actions workflow.

What are we going to do:

  • Create a GitHub repository with a license.
  • Create an action.yaml file with inputs and outputs.
  • Create our bash script.
  • Create a Dockerfile.

Optional:

  • Test it locally with act.
  • Publish the action to the GitHub Action Marketplace.

You can find everything we will do in this GitHub repository.

programming devops aws github-actions github

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Deploy using Github Actions on AWS Elastic BeanStalk

In this article I’d be going through the process of deploying Node application on AWS Elastic BeanStalk using Github Actions.

GitHub Demo Days - Using GitHub Actions for testing cloud native applications

A common challenge that cloud native application developers face is manually testing against inconsistent environments. GitHub Actions can be triggered based on nearly any GitHub event making it possible to build in accountability for updating tests and fixing bugs.

Have Your ML Models Built Automatically Using GitHub Actions

How to publish a custom GitHub Action on Marketplace for building Machine Learning Applications.

How to Compare Multiple GitHub Projects with Our GitHub Stats tool

In this article we are going to compare three most popular machine learning projects for you.

How to Extend your DevOps Strategy For Success in the Cloud?

DevOps and Cloud computing are joined at the hip, now that fact is well appreciated by the organizations that engaged in SaaS cloud and developed applications in the Cloud. During the COVID crisis period, most of the organizations have started using cloud computing services and implementing a cloud-first strategy to establish their remote operations. Similarly, the extended DevOps strategy will make the development process more agile with automated test cases.