Skip to main content
In this lesson we’ll migrate a simple Jenkins freestyle job into a GitHub Actions workflow. The goal is to replicate the Jenkins job behavior (a sequence of shell steps run on a single node) by creating a single-job workflow that can be manually triggered from the Actions UI. Below are the original Jenkins job and its build steps, followed by a concise GitHub Actions workflow that reproduces the same execution flow on ubuntu-latest.
A dark-themed Jenkins dashboard screenshot showing a list of CI pipeline jobs (ci-pipeline-poll-scm, Generate ASCII Artwork, scripted-pipeline, solar-system-ci-pipeline) with columns for last success, failure, and duration. The left sidebar shows navigation items like New Item, Build History, Manage Jenkins and a Build Queue panel.
This migration focuses on the “Generate ASCII Artwork” freestyle job. Open its configuration to inspect the build steps and options.
A screenshot of the Jenkins web UI showing the "Configure" page for a job (Generate ASCII Artwork) with the General settings panel, description field, and several option checkboxes. The sidebar lists other sections (Source Code Management, Triggers, Environment, Build Steps) and Save/Apply buttons are visible at the bottom.
Key characteristics of this Jenkins job:
  • No source control is configured (it was run manually in Jenkins).
  • No automated triggers (built manually).
  • No environment variables defined.
  • Several shell build steps that run sequentially on one build node.
A dark-themed Jenkins "Configure" settings screen showing the Triggers and Environment sections with multiple checkboxes (e.g., Poll SCM, Build periodically). The left sidebar lists job configuration tabs like General, Source Code Management, Triggers, and Build Steps.
Below is the core shell script the Jenkins job ran. It:
  • Calls the adviceslip API to fetch a piece of advice.
  • Validates the advice contains more than five words.
  • Installs cowsay and prints the advice as ASCII art.
Migration approach summary:
  • Jenkins freestyle -> GitHub Actions single job.
  • Keep the same shell flow, but place it in one multi-line run step.
  • Use workflow_dispatch to allow manual triggering from the Actions UI.
  • Install required packages (jq, cowsay) on the runner before use.
Below is an example multi-job workflow (for reference) illustrating jobs, dependencies, environment variables, and artifacts in GitHub Actions:
For our single-job migration, create a file at .github/workflows/generate-ascii.yaml with workflow_dispatch so it can be triggered manually. Here is a concise, robust workflow that reproduces the Jenkins behavior:
Best practice: Put package installation at the top of your step so required tools are available before they are referenced. If you need persistent environment variables or secrets, declare them at the workflow or job level using env: or GitHub Secrets.
Quick mapping: Jenkins freestyle fields to GitHub Actions equivalents Open the Actions tab in your repository and trigger the workflow manually. The job log will show output for each command just like Jenkins.
A dark-theme GitHub Actions page showing a repository's workflows and sidebar (including a "Generate ASCII Artwork" entry). The main panel lists recent workflow runs (several "Demo-2" entries) with success/failure icons, branch tags and timestamps.
Example log snippets you’ll see:
  • The adviceslip JSON and the validation success message:
  • Installation output and the generated ASCII artwork:
If the advice has five words or fewer, the step prints the advice and exits with code 1, causing the job to fail. Example failure output:
Note: When a script exits with a non-zero status, GitHub Actions marks the step and job as failed. Design your exit codes intentionally if you rely on failure vs. success conditions for downstream steps or notifications.
References and useful links: Next steps:
  • If you need to preserve job-level environment variables, add env: at the workflow or job level.
  • To split work into stages, convert sequential shell steps into separate jobs and use needs: to express dependencies.
  • A follow-up lesson will cover converting a multi-stage Jenkins pipeline into a multi-job GitHub Actions workflow.

Watch Video