Saturday, 28 February 2026

#00 Action

GitHub Actions Tutorial for Undergrads

Mastering GitHub Actions: A Hands-On Guide

Step-by-step tutorials for undergraduate developers to automate workflows.

Module 1

Creating Your First Example Workflow

Learn the basics of GitHub Actions by creating a simple automated greeting [1, 2].

The Code (.github/workflows/hello-world.yml)

name: Greet User
on: [push]
jobs:
  hello-job:
    runs-on: ubuntu-latest
    steps:
      - name: Say Hello
        run: echo "Hello, GitHub Actions!"
        

How-to Run

  1. Create a directory named .github/workflows in your repo root.
  2. Save the code above as hello-world.yml.
  3. Commit and push to GitHub. Navigate to the Actions tab to see it run.
Hands-on Exercise: Modify the workflow to print your name and the current date using the date command.
Module 2

Building and Testing Code (Python Example)

Automate your Continuous Integration (CI) to ensure code quality with every push [1, 2].

The Code (.github/workflows/python-app.yml)

name: Python Package
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python
      uses: actions/setup-python@v5
      with:
        python-version: '3.x'
    - name: Install dependencies
      run: pip install -r requirements.txt
    - name: Run Tests
      run: pytest
        

How-to Run

Ensure your repo has a requirements.txt and a tests/ directory. Push your code, and GitHub will automatically install dependencies and run tests [2].

Hands-on Exercise: Intentional failure! Create a test that fails and observe how GitHub Actions marks the build as failed with a red "X".
Module 3

Creating Custom Actions

Go beyond pre-built tools by creating your own JavaScript or Composite actions [2, 3].

The Code (action.yml)

name: 'Hello World Action'
description: 'Greet someone'
inputs:
  who-to-greet:
    description: 'Who to greet'
    required: true
    default: 'World'
runs:
  using: 'node20'
  main: 'index.js'
        

How-to Run

Define your metadata in action.yml and your logic in index.js. You can then reference this action in any workflow using uses: ./path-to-action [3].

Hands-on Exercise: Create a composite action that combines multiple shell commands into a single reusable step [3].
Module 4

Managing Work with Actions

Automate project management tasks like labeling issues or closing inactive ones [2, 3].

The Code

name: Label Issues
on:
  issues:
    types: [opened]
jobs:
  label_issue:
    runs-on: ubuntu-latest
    steps:
      - name: Label as 'triage'
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.issues.addLabels({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              labels: ['triage']
            })
        

How-to Run

This workflow triggers whenever a new issue is opened. It uses the GITHUB_TOKEN for authentication [1, 2].

Hands-on Exercise: Set up a workflow to comment on an issue automatically when a specific label is added [2].
Module 5

Storing Data and Using Services

Learn to store workflow artifacts and use containerized services like Redis or PostgreSQL [2, 3].

The Code (Artifact Upload)

- name: Archive production artifacts
  uses: actions/upload-artifact@v4
  with:
    name: dist-files
    path: dist/
        

How-to Run

Use the upload-artifact action to save build results. For databases, use services in your job definition to spin up a Docker container [2].

Hands-on Exercise: Create a workflow that generates a text file, uploads it as an artifact, and then download it from the GitHub Actions UI [2].

© 2026 Tutorial Series | References: GitHub Docs [1-4]

#00 Action

GitHub Actions Tutorial for Undergrads Mastering GitHub Actions: A Hands-On Guide Step-by-step tutorials...