Convert Jenkins pipelines (Jenkinsfiles) to GitHub Actions workflows...
Convert Jenkins Declarative and Scripted Pipelines to GitHub Actions workflows.
GitHub provides automated migration tooling:
gh actions-importer CLI for automated conversionThis skill provides detailed mappings for manual conversion and edge cases the automated tool misses.
| Jenkins | GitHub Actions |
|---|---|
pipeline {} |
.github/workflows/*.yml |
agent any |
runs-on: ubuntu-latest |
stages {} |
jobs: |
steps {} |
steps: |
environment {} |
env: |
when { branch 'main' } |
if: github.ref == 'refs/heads/main' |
parallel {} |
Multiple jobs (parallel by default) |
post { always {} } |
if: always() |
input (approval) |
environment: with reviewers |
See references/concept-mappings.md for complete mappings.
Identify:
@Library)For complex pipelines:
@Library('my-lib'). Do you have an equivalent reusable workflow?"input step. Use GitHub Environments with required reviewers?"Apply mappings from reference docs:
Always list:
// Jenkins
parallel {
stage('Unit') { steps { sh 'npm test:unit' } }
stage('Lint') { steps { sh 'npm run lint' } }
}
# GitHub Actions - jobs run in parallel by default
jobs:
unit:
runs-on: ubuntu-latest
steps:
- run: npm test:unit
lint:
runs-on: ubuntu-latest
steps:
- run: npm run lint
// Jenkins
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: 'aws']]) {
sh 'aws s3 ls'
}
# GitHub Actions - prefer OIDC over stored secrets
permissions:
id-token: write
steps:
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
- run: aws s3 ls
// Jenkins
input message: 'Deploy to prod?', submitter: 'release-team'
# GitHub Actions - configure required reviewers in repo settings
jobs:
deploy:
environment: production
When generating a workflow:
@abc123 # v4.1.1)timeout-minutes set on all jobsconcurrency group to prevent duplicate runspermissions