Author: Alfred Yip
Reviewers: James Pang, Tan Yuanhong, Tejas Bhuwania, Daryl Tan
GitHub Actions is a workflow automation solution that is tightly integrated into the GitHub ecosystem. It is commonly used to provide end-to-end continuous integration and deployment (CI/CD) directly in a repository. Beyond that, users also have the potential to automate more than just CI/CD with GitHub Actions through GitHub's webhooks API, including workflows such as labelling issues and tracking bundle size.
Setting up a workflow in a repository is easy and hassle-free. Starter workflows for popular languages are available and the built-in editor offers code completion and documentation at a glance.
Actions are small, reusable units in a workflow. When setting up a workflow, we can reuse actions written by the community. These actions are available at the marketplace.
GitHub Actions gives you the option to run workflows on Ubuntu, Windows and macOS.
GitHub Actions provides the ability to run docker images for projects that use a dockerized environment.
Integration with the GitHub ecosystem allows GitHub Actions to do more than just build/test/deploy. You can automate everything related to your GitHub project, including bug triaging, labeling, automated dependency updating etc. Workflows can be triggered by events that happen on GitHub and will have access to the context of the issue/PR/commit that triggered it.
Like many of its competitors, GitHub Actions provides free unlimited runner time for public repositories.
For private repositories, the runner time you get with a free plan is limited, but still ample for hobby projects.
Workflow
A workflow describes a sequence of jobs to be run when a trigger event occurs.
Each job consists of a series of steps, which may be actions or shell commands.
Each workflow is defined as a .yml
file in the .github/workflows
directory of a repository.
Action An action is a piece of code that performs an atomic task. For example, checking out a repository, or caching dependencies.
Triggers Workflows can be triggered by events on the GitHub repository, ranging from opening pull requests or issues, making commits to scheduled events, or even from an external event by calling GitHub's REST API endpoint.
GitHub has made it extremely easy to set up a simple workflow without even leaving the browser.
master
branch, when we commit the newly-created workflow file, we can see GitHub Actions in action by navigating to the Actions tab
The official documentation is a good resource to learn more about GitHub Actions. The starter workflows repository contains good examples of CI workflows for popular languages as well as automation workflows for GitHub. Here is a list of awesome actions that you can use when writing your workflow.
A powerful extension to GitHub Actions is to use the github-script action to run JavaScript within the workflow using GitHub's Octokit API. The Octokit API allows you to create workflows that span across GitHub's ecosystem of services.
Here is a compiled list of popular repositories that use GitHub Actions that you can use as a reference. Do note that this is far from a comprehensive list and is more of a sample of how organizations are leveraging GitHub Actions in their development and production workflow.