Note: GitHub Actions was available for GitHub Enterprise Server 2.22 as a limited beta. The beta has ended. GitHub Actions is now generally available in GitHub Enterprise Server 3.0 or later. For more information, see the GitHub Enterprise Server 3.0 release notes.
- For more information about upgrading to GitHub Enterprise Server 3.0 or later, see "Upgrading GitHub Enterprise Server."
- For more information about configuring GitHub Actions after you upgrade, see the documentation for GitHub Enterprise Server 3.0.
Note: GitHub-hosted runners are not currently supported on GitHub Enterprise Server. You can see more information about planned future support on the GitHub public roadmap.
Introduction
Azure Pipelines and GitHub Actions both allow you to create workflows that automatically build, test, publish, release, and deploy code. Azure Pipelines and GitHub Actions share some similarities in workflow configuration:
- Workflow configuration files are written in YAML and are stored in the code's repository.
- Workflows include one or more jobs.
- Jobs include one or more steps or individual commands.
- Steps or tasks can be reused and shared with the community.
For more information, see "Core concepts for GitHub Actions."
Key differences
When migrating from Azure Pipelines, consider the following differences:
- Azure Pipelines supports a legacy classic editor, which lets you define your CI configuration in a GUI editor instead of creating the pipeline definition in a YAML file. GitHub Actions uses YAML files to define workflows and does not support a graphical editor.
- Azure Pipelines allows you to omit some structure in job definitions. For example, if you only have a single job, you don't need to define the job and only need to define its steps. GitHub Actions requires explicit configuration, and YAML structure cannot be omitted.
- Azure Pipelines supports stages defined in the YAML file, which can be used to create deployment workflows. GitHub Actions requires you to separate stages into separate YAML workflow files.
- On-premises Azure Pipelines build agents can be selected with capabilities. GitHub Actions self-hosted runners can be selected with labels.
Migrating jobs and steps
Jobs and steps in Azure Pipelines are very similar to jobs and steps in GitHub Actions. In both systems, jobs have the following characteristics:
- Jobs contain a series of steps that run sequentially.
- Jobs run on separate virtual machines or in separate containers.
- Jobs run in parallel by default, but can be configured to run sequentially.
Migrating script steps
You can run a script or a shell command as a step in a workflow. In Azure Pipelines, script steps can be specified using the script
key, or with the bash
, powershell
, or pwsh
keys. Scripts can also be specified as an input to the Bash task or the PowerShell task.
In GitHub Actions, all scripts are specified using the run
key. To select a particular shell, you can specify the shell
key when providing the script. For more information, see "Workflow syntax for GitHub Actions."
Below is an example of the syntax for each system:
Azure Pipelines | GitHub Actions |
---|---|
|
|
Differences in script error handling
In Azure Pipelines, scripts can be configured to error if any output is sent to stderr
. GitHub Actions does not support this configuration.
GitHub Actions configures shells to "fail fast" whenever possible, which stops the script immediately if one of the commands in a script exits with an error code. In contrast, Azure Pipelines requires explicit configuration to exit immediately on an error. For more information, see "Workflow syntax for GitHub Actions."
Differences in the default shell on Windows
In Azure Pipelines, the default shell for scripts on Windows platforms is the Command shell (cmd.exe). In GitHub Actions, the default shell for scripts on Windows platforms is PowerShell. PowerShell has several differences in built-in commands, variable expansion, and flow control.
If you're running a simple command, you might be able to run a Command shell script in PowerShell without any changes. But in most cases, you will either need to update your script with PowerShell syntax or instruct GitHub Actions to run the script with the Command shell instead of PowerShell. You can do this by specifying shell
as cmd
.
Below is an example of the syntax for each system:
Azure Pipelines | GitHub Actions |
---|---|
|
|
For more information, see "Workflow syntax for GitHub Actions."
Migrating conditionals and expression syntax
Azure Pipelines and GitHub Actions can both run steps conditionally. In Azure Pipelines, conditional expressions are specified using the condition
key. In GitHub Actions, conditional expressions are specified using the if
key.
Azure Pipelines uses functions within expressions to execute steps conditionally. In contrast, GitHub Actions uses an infix notation. For example, you must replace the eq
function in Azure Pipelines with the ==
operator in GitHub Actions.
Below is an example of the syntax for each system:
Azure Pipelines | GitHub Actions |
---|---|
|
|
For more information, see "Expressions."
Dependencies between jobs
Both Azure Pipelines and GitHub Actions allow you to set dependencies for a job. In both systems, jobs run in parallel by default, but job dependencies can be specified explicitly. In Azure Pipelines, this is done with the dependsOn
key. In GitHub Actions, this is done with the needs
key.
Below is an example of the syntax for each system. The workflows start a first job named initial
, and when that job completes, two jobs named fanout1
and fanout2
will run. Finally, when those jobs complete, the job fanin
will run.
Azure Pipelines | GitHub Actions |
---|---|
|
|
For more information, see "Workflow syntax for GitHub Actions."
Migrating tasks to actions
Azure Pipelines uses tasks, which are application components that can be re-used in multiple workflows. GitHub Actions uses actions, which can be used to perform tasks and customize your workflow. In both systems, you can specify the name of the task or action to run, along with any required inputs as key/value pairs.
Below is an example of the syntax for each system:
Azure Pipelines | GitHub Actions |
---|---|
|
|
You can find actions that you can use in your workflow in GitHub Marketplace, or you can create your own actions. For more information, see "Creating actions."