A GitHub Action is a reusable automation component used as a step in a GitHub Actions workflow. Actions can check out repositories, build code, review code, or prepare deployment environments on a hosted runner. section 16.1
Use actions to assemble workflow automation, while keeping substantial application logic in scripts:
- Define the workflow in YAML inside the repository. section 16.1
- Reference an action with a uses entry, such as actions/checkout@master. section 16.1
- Prefer scripts for most build logic when portability, local debugging, or migration to another build provider matters. section 16.1
Creating a Kubernetes test cluster
A deployment workflow can use AbsaOSS/k3d-action@v2 to create a single-node Kubernetes cluster on the GitHub runner, then run kubectl config use-context k3d-ch16. The action packages k3d setup so the workflow does not install and configure the tool separately. section 16.4
Listing 16.5 Running a test Kubernetes cluster with k3d
# this creates a single-node Kubernetes cluster in a container:
- name: create-cluster
uses: AbsaOSS/k3d-action@v2
with:
cluster-name: ch16
args: >-
--agents 1
--no-lb
--k3s-arg "--no-deploy=traefik,servicelb,metrics-server"
# and this sets the Kubectl CLI to use that cluster:
- name: set-context
run: |
kubectl config use-context k3d-ch16
Inspect the complete action configuration for creating the cluster and selecting its Kubernetes context. section 16.4
Actions are convenient but specific to GitHub workflow YAML. Keeping the main logic in PowerShell or other scripts makes it runnable locally and easier to move between CI/CD services. section 16.1


