Skip to main content
This guide shows how to migrate declarative Jenkins pipelines (and many freestyle jobs) to GitHub Actions using the GitHub Actions Importer (gh-actions-importer). The importer automates most conversion steps and can open a pull request in your repository with the generated workflow. What you’ll accomplish
  • Configure the importer to authenticate to both Jenkins and GitHub.
  • Preview conversions with dry-run.
  • Create a branch and pull request in GitHub with migrate.
  • Review and adjust the workflow, then run it in GitHub Actions.

Prerequisites

Limitations

A screenshot of the GitHub Docs page for GitHub Actions (dark theme) showing guidance on migrating from Jenkins, with a left navigation menu and main content listing prerequisites and limitations. Browser tabs and window UI are visible along the top.
Note: Keep access tokens secure — store them in a secrets manager or environment variables, not in plaintext inside repositories.
You will use the GitHub CLI (gh) plus the gh-actions-importer extension. The importer runs locally and calls both Jenkins and GitHub APIs, so it requires credentials for both systems (JENKINS_USERNAME, JENKINS_ACCESS_TOKEN, and a GitHub Personal Access Token with workflow scope).

Install GitHub CLI and the Importer extension

Install GitHub CLI on Debian/Ubuntu (run as root or with sudo):
Install the GitHub Actions Importer extension:
View the importer help:
Sample (truncated) output:

Authenticate with gh

Log in and connect gh to your GitHub account:
Follow the interactive prompts:
  • Select GitHub.com.
  • Use HTTPS for Git operations.
  • Authenticate via browser (device/web flow).
After authorizing in the browser, gh will be linked to your account and allow the extension to push branches and create PRs.
A GitHub OAuth authorization page showing a list of organizations with checkmarks for requested access and buttons to "Cancel" or "Authorize github." Several org icons and names are visible in the middle of the dark-themed screen.

Configure GitHub Actions Importer credentials

Run the importer’s interactive configuration to store credentials used during migration:
When prompted, provide:
  • GitHub Personal Access Token (classic) — include workflow scope (and repo if needed).
  • Jenkins username and Jenkins API token.
  • Base URLs for GitHub (https://github.com) and your Jenkins instance.
How to get tokens
A screenshot of a Jenkins user configuration page for the account "siddharth," showing fields for Full Name and Description and an API Token section with a token labeled "github importer." The left sidebar lists navigation items (Status, Builds, Configure, etc.) and Save/Apply buttons are visible at the bottom.
The configure command writes environment variables used by the importer (JENKINS_USERNAME, JENKINS_ACCESS_TOKEN, GITHUB_TOKEN, etc.), so subsequent commands can access Jenkins and GitHub.

Update the importer image

Before running conversions, update the importer container image:
Expected output:

Audit and forecast (optional)

  • gh actions-importer audit enumerates discovered Jenkins jobs and reports conversion readiness.
  • gh actions-importer forecast estimates GitHub Actions runtime usage based on historical builds (Jenkins may need plugins to expose build history).
Example audit:
This walkthrough skips audit/forecast and proceeds to converting a job using dry-run.

Dry-run: convert a Jenkins job to a workflow YAML

Use dry-run to convert a single Jenkins job and write the generated workflow YAML to a directory. Replace the --source-url with your Jenkins job URL:
Authentication errors example:
If you see authentication failures, re-generate or re-enter the Jenkins API token with gh actions-importer configure and retry. Example of the generated workflow YAML from dry-run (excerpt):
This output shows:
  • The importer created a workflow named Generate_ASCII_Artwork.
  • It uses workflow_dispatch (manual run) and a build job on ubuntu-latest.
  • The job includes actions/checkout and shell commands ported from the original Jenkins job.

Migrate: create a branch and pull request in GitHub

To push the generated workflow into a repository and open a PR, use migrate. Provide the Jenkins source URL and the GitHub target repository:
Successful example output:
What migrate does:
  • Creates a branch.
  • Commits .github/workflows/<workflow>.yml.
  • Opens a pull request in the target repository.
Representative diff created by the importer (excerpt):
Review the PR, make any necessary changes (see next section), and then merge the PR to add the workflow to the repository.

Adjust the workflow if needed and run

Common adjustments after conversion:
  • Remove or populate an empty env: block (empty env: can trigger YAML validation errors).
  • Add triggers such as push: if you want the workflow to run automatically on push events.
  • Install missing packages with apt-get update before apt-get install to avoid cache errors.
  • Replace sudo apt-get install cowsay -y with an apt-get update + apt-get install -y cowsay sequence.
Example corrected workflow used in this walkthrough:
After merging and committing the final YAML:
  • Trigger the workflow by pushing changes or using the Actions UI to run a workflow_dispatch.
  • Monitor the run logs in the Actions tab.
A screenshot of the Jenkins web interface showing a job page titled "Generate ASCII Artwork" with permalinks, job details, and a left-side menu (Status, Build Now, Configure, etc.). The page uses a dark theme and displays recent build history.
Screenshot of a GitHub Actions page for a repository, showing the "All workflows" view with two workflow runs for Generate_ASCII_Artwork — one queued update and one failed run. The interface is in dark mode.
Example run log excerpt (shows API response and cowsay output):

Summary / Checklist

  • Install gh and add the gh-actions-importer extension.
  • Authenticate gh and configure the importer (gh actions-importer configure) with GitHub and Jenkins credentials.
  • Use gh actions-importer dry-run to preview the generated workflow YAML before pushing changes.
  • Use gh actions-importer migrate to create a branch and open a PR with .github/workflows/<workflow>.yml.
  • Review and adjust triggers, env, package installation steps, and replace any plugin-specific Jenkins steps with suitable Actions.
  • Recreate Jenkins secrets as GitHub Secrets — the importer does not migrate secrets.
The importer cannot convert scripted Jenkins pipelines, Jenkins credentials/secrets, or steps that depend on custom/unknown plugins. Plan to re-create secrets in GitHub and manually validate plugin-dependent steps in the resulting workflow.
That’s it — the GitHub Actions Importer streamlines converting declarative Jenkins pipelines and many freestyle jobs into GitHub Actions workflows, but expect to review and fine-tune converted workflows and recreate secrets in GitHub.

Watch Video