GitHub announced GitHub Actions in late 2018 as a new CI/CD platform where users can automate workflows and build development cycles.
The best part of the actions is that they are event-driven. Events in a GitHub repository can trigger actions to run on-demand workflows.
In this article, I listed the top 10 GitHub Actions that are really useful for the developer community while setting up a CI/CD pipeline.
There are a lot of actions called Setup which allow you to set up your GitHub workflows with the programming language of your choice. Most of the setup actions are used for downloading and setting up a requested version of the runtime.
Checkout downloads your Git repository in your local environment to let your workflow access it and it checks out your target repository to run the GitHub actions on top of it.
There are a lot of scenarios that you can make with Checkout. You can push a commit using the built-in token or fetch all history for all tags and branches are only two scenarios.
Using Cache action, you don’t have to download frequently used dependencies anymore. It allows caching dependencies and builds outputs to improve workflow execution time.
The cache is very useful while building a CI/CD pipeline by cost-saving and freeing up network utilization.
Sharing data between jobs is a lot of work. Upload Artifact action automates this hard work and enables you to upload your artifacts from your workflow allowing you to share data between jobs and store data once a workflow is complete.
Be cautious that if your workflow uploads a high number of artifacts in a short period of time, you may see them blocked due to exceeding usage.
But to overcome this, you can reduce the number of HTTP calls made during artifact upload by zipping or archiving the contents of your artifact before an upload starts.
The Download Artifact action downloads artifacts from your build in your GitHub repository.
You can either download a single artifact or all artifacts at once with this action. The action provides an output parameter for the download path to ease the use.
Create Pull Request GitHub action creates a pull request for changes to your repository.
This is a really useful action to use along with other actions that add or modify files to your repositories. Create Pull Request action automatically commits the changes to a new branch and creates a pull request.
Merge pull requests Github action automatically merges pull requests when they are ready to go. It adds an auto merge label on the pull requests and runs its tasks.
The action grabs the changes from the base branch and when the pull request is ready, it automatically merges into the pull request.
One last note; the branch created by the action will not be deleted after the pull request has been merged successfully. You need to use some automatic deletion actions for cleaning up.
Docker build and push action creates a Docker image and pushes it to a registry that you choose such as GitHub Docker Registry, Docker Hub, GCR, or AWS ECR.
You can do many things with this action. For example, you can share built images between jobs. In other words, you can pass data between jobs in a workflow.
Many other useful automation actions are available with this action. You can copy Docker images between registries without changing the image SHA. You can export images to Docker if you want your build result available in Docker. You can build multi-platform images, you can handle tags and labels, and more.
Slack Notify GitHub Action is a great automation piece for notification.
Let’s take an open-source project as an example, there might be a lot of contributors who don’t know each other.
And when you integrate such a notification tool inside your workflows, you can notify project contributors about your new commits inside Slack.
Foresight GitHub app enables you to monitor and troubleshoot your GitHub Actions CI workflows, tests, builds, and jobs.
One of the most important and underestimated parts of a CI/CD pipeline is the monitoring part. With Foresight, you can monitor your workflows’ resource usage metrics, understand workflow costs, duration, success & failure rates, jobs with high failure rates, and more.
Visit Foresight for more information.
These GitHub actions aim to automate parts of your CI/CD pipeline. There are thousands of GitHub actions available for helping to automate some workflows.
Summing up, GitHub Actions is an invaluable tool to design automated workflows only limited with your imagination. I want to close this article by stressing the importance of observability in continuous integration and continuous deployment pipelines.
Being able to see the metrics of all of your workflows consolidated in a single dashboard is something needed. When a build fails, having the toolkit dive into test code and replay it line by line is a cherry on top. Or seeing a trace map of all the dependencies of your tested application is kind of a double cherry on top!
Save the date! 🕊️
On the 28th of September, we are launching Foresight on Product Hunt 🎉🍻
Take your seat before we launch on Product Hunt 💜