This device is not compatible.

Build a Custom GitHub Actions in Rust

PROJECT


Build a Custom GitHub Actions in Rust

In this project, we will build a custom GitHub Actions that can be used to count the number of TODO comments in our source code and display it in the job summary at the end of each workflow run.

Build a Custom GitHub Actions in Rust

You will learn to:

Create a Rust-based GitHub Actions repository with the required descriptor file.

Implement command-line option and environment variable parsing in Rust.

Scan the filesystem to count the number of TODO comments in source files.

Implement interaction with GitHub Actions job output.

Create a Dockerfile for the custom action.

Create a workflow to build and publish the Docker image.

Skills

Unit Testing

Docker Images

Task Automation

Prerequisites

Basic understanding of Rust

Good understanding of Docker and Dockerfiles

A working and valid GitHub account

Technologies

Rust

Docker

GitHub logo

GitHub

Project Description

GitHub Actions are great for automating builds, software releases, and overall GitHub repository management. They come with a rich ecosystem full of reusable functions for a wide variety of tasks and workflows. For those times when custom functionality is required, GitHub Actions allow us to develop our own and even share it with others in the marketplace. Docker-based actions are appropriate for complex tasks. This approach allows us to use any language to develop our custom action, but, ideally, it would result in a small Docker image that is fast and efficient.

Rust is a typed, memory-safe systems programming language that can be ideal for just this kind of situation. With the right approach, it allows us to build a Docker image that is no larger than a few megabytes, which means short start-up times and resource-efficient execution.

In this project, we will build a custom GitHub Action that can be used to count the number of TODO comments in our source code.

Project Tasks

1

Introduction

Task 0: Get Started

Task 1: Set up a Docker Container for GitHub Actions

Task 2: Initialize GitHub Actions Configuration

Task 3: Test the Custom Action with a GitHub Workflow

2

Basic Functionality

Task 4: Locate Repository Root in GitHub Actions

Task 5: Process Directories Recursively

Task 6: Iterate Over Lines of Text

Task 7: Scan Lines for TODOs

Task 8: Add Unit Tests

3

Inputs and Outputs

Task 9: Format Log Output

Task 10: Define Input Parameters

Task 11: Parse Command-Line Arguments

Task 12: Generate Step Summary

Task 13: Define Output Parameter

Task 14: Write Output Parameter

4

Continuous Integration

Task 15: Create a GitHub Repository

Task 16: Customize Release Profile

Task 17: Build and Publish Docker Image

Task 18: Use Published Docker Image

Congratulations!

has successfully completed the Guided ProjectBuild a Custom GitHub Actions in Rust

Relevant Courses

Use the following content to review prerequisites or explore specific concepts in detail.