GitHub Actions Simple Example: Get Started in Minutes

Logan Jul 13, 2026

Welcome to the world of streamlined software development, where coding, testing, and deployment happen in harmony. GitHub Actions simplifies and automates your workflow like never before, transforming your repository into a powerful, responsive CI/CD system. Let's dive into a simple example to get you started.

Optimize GitHub Actions Performance: Boost Your CI/CD Workflows 🚀⚡
Optimize GitHub Actions Performance: Boost Your CI/CD Workflows 🚀⚡

In this guide, we'll create a straightforward workflow that triggers on pull requests and automatically runs tests. By the end, you'll have a clear understanding of how GitHub Actions can elevate your project's efficiency.

A Beginners Guide to CI/CD with GitHub Actions
A Beginners Guide to CI/CD with GitHub Actions

Setting Up Your First Workflow

First, let's understand where GitHub Actions lives in your repository. Look for the '.github' folder, and inside it, create a new directory called 'workflows'. This is where your workflow files will reside.

How GitHub Actions 10x my productivity
How GitHub Actions 10x my productivity

Create a new file named 'hello-world.yml' (without any extension) inside the 'workflows' folder. This file will define your custom workflow.

Hello, World! - Your First Action

Git Workflow
Git Workflow

To start, let's create a simple workflow that prints "Hello, World!" whenever you push changes to a specific branch. Here's the content for your 'hello-world.yml' file:

```yaml name: Hello, World! on: push: branches: [ main ] jobs: say-hello: runs-on: ubuntu-latest steps: - name: Say Hello run: echo "Hello, World!" ```

In this example, the workflow triggers on changes pushed to the 'main' branch. It then runs a single job that executes a 'Hello, World!' message.

Running Tests - Automating Quality Assurance

the git diagram shows how to use it
the git diagram shows how to use it

Now, let's make your workflow more useful by adding automatic tests. For this example, we'll use Node.js with Jest, a popular JavaScript testing framework.

```yaml name: Run Tests on: pull_request: branches: [ main ] jobs: test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Set up Node.js uses: actions/setup-node@v2 with: node-version: '14' - name: Install dependencies run: npm ci - name: Run tests run: npm test ```

In this workflow, tests run automatically whenever you open a pull request targeting the 'main' branch. It checks out the code, sets up Node.js, installs dependencies, and finally runs your tests.

Exploring Workflow Runs and Environments

a laptop computer sitting on top of a desk next to a cup of coffee and pen
a laptop computer sitting on top of a desk next to a cup of coffee and pen

GitHub Actions provides a user-friendly interface to view and manage your workflow runs. You can find them in your repository's 'Actions' tab. Here, you can see the status, logs, and output of each run, helping you quickly diagnose and fix any issues.

Actions also supports multiple environments, allowing you to test your code in different configurations. You can set up environments manually or create them dynamically using deployment strategies or other triggers. This ensures your code works seamlessly across various environments.

Getting Started With GitHub Actions
Getting Started With GitHub Actions
Git & GitHub Cheat Sheet for Beginners
Git & GitHub Cheat Sheet for Beginners
What is Git? (Day 1 Beginner Guide)
What is Git? (Day 1 Beginner Guide)
a computer screen with the text stop forgeting git
a computer screen with the text stop forgeting git
Git Workflow Roadmap
Git Workflow Roadmap
🤝 Collaborating on GitHub with Remote Repositories
🤝 Collaborating on GitHub with Remote Repositories
Git
Git
The Ultimate Git Commands Cheat Sheet for Developers 🚀💻 #git #command #code
The Ultimate Git Commands Cheat Sheet for Developers 🚀💻 #git #command #code
GitHub API: How to retrieve the combined pull request status from commit statuses, check runs, and GitHub Action results
GitHub API: How to retrieve the combined pull request status from commit statuses, check runs, and GitHub Action results
an info sheet with different types of font and numbers, including the letter j in red
an info sheet with different types of font and numbers, including the letter j in red
How to Use Github Actions to Automate Your Repository Builds
How to Use Github Actions to Automate Your Repository Builds
an info poster showing the different stages of branding
an info poster showing the different stages of branding
GitHub - jerosoler/Drawflow: Simple flow library 🖥️🖱️
GitHub - jerosoler/Drawflow: Simple flow library 🖥️🖱️
Master Git Essentials: A Developer's Guide to Version Control 🚀
Master Git Essentials: A Developer's Guide to Version Control 🚀
How to get trending GitHub projects in your Chrome new tab screen with GitHunt
How to get trending GitHub projects in your Chrome new tab screen with GitHunt
Lessons Learned from Enterprise Usage of GitHub Actions
Lessons Learned from Enterprise Usage of GitHub Actions
Git and GitHub Tutorial for Beginners
Git and GitHub Tutorial for Beginners
the git cheatshet is shown in this screenshote, which shows how to
the git cheatshet is shown in this screenshote, which shows how to
git status Explained (Day 4 Git Guide)
git status Explained (Day 4 Git Guide)
Git Push Command
Git Push Command

Upgrading Your Workflow - Secrets and More

As your projects grow, you'll need to secure sensitive information like API keys, database credentials, and tokens. GitHub Actions securely stores and uses secrets, keeping your sensitive data safe.

You can also upgrade your workflow with more complex actions,Using third-party community actions or creating your own. With a wide range of actions available, you can handle tasks like building Docker images, deploying to servers, and even more specialized tasks.

There you have it - a simple yet powerful introduction to GitHub Actions. From automating tests to orchestrating complex deployments, GitHub Actions ensures your software development stays efficient and enjoyable. Now that you've dipped your toes, explore the vast opportunities that GitHub Actions offers, and transform your workflow for the better.