Top 10 GitHub Actions You Should Use to set up your CI/CD Pipeline
Tags: github, devops, cicd, cloud
Published: 2022-09-12 13:34:25

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.

![image2](https://assets.website-files.com/6294d502b5093e3965b91f4d/62bed524ef329f065386cd58_Top%252010%2520GitHub%2520Actions%2520You%2520Should%2520Use%2520in%25202021-3.png)

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.

## 1. Setup

![image3](https://assets.website-files.com/6294d502b5093e3965b91f4d/62bed5248496fa232e63f196_Top%252010%2520GitHub%2520Actions%2520You%2520Should%2520Use%2520in%25202021-Oct-14-2021-07-32-32-25-AM.png)

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.

The most popular ones are  [**Node.js**](https://github.com/actions/setup-node),  [**Python**](https://github.com/actions/setup-python),  [**Java JDK**](https://github.com/actions/setup-java),  [**Go**](https://github.com/actions/setup-go),  [**.Net Core SDK**](https://github.com/actions/setup-dotnet).

## 2. Checkout

![image4](https://assets.website-files.com/6294d502b5093e3965b91f4d/62bed5241ed5852208492339_Top%252010%2520GitHub%2520Actions%2520You%2520Should%2520Use%2520in%25202021-Oct-14-2021-07-32-33-11-AM.png)

[**Checkout**](https://github.com/marketplace/actions/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**](https://github.com/marketplace/actions/checkout#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.

## 3. Cache

![image5](https://assets.website-files.com/6294d502b5093e3965b91f4d/62bed524cf484c592a7662ed_Top%252010%2520GitHub%2520Actions%2520You%2520Should%2520Use%2520in%25202021.png)

Using  [**Cache action**](https://github.com/marketplace/actions/cache), 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.

## 4. Upload Artifact

![image6](https://assets.website-files.com/6294d502b5093e3965b91f4d/62bed524b5d9b84a6652b933_Top%252010%2520GitHub%2520Actions%2520You%2520Should%2520Use%2520in%25202021-Oct-14-2021-07-32-32-96-AM.png)

Sharing data between jobs is a lot of work.  [**Upload Artifact**](https://github.com/marketplace/actions/upload-a-build-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.

## 5. Download Artifact

![image 7](https://assets.website-files.com/6294d502b5093e3965b91f4d/62bed52431173395656a8650_Top%252010%2520GitHub%2520Actions%2520You%2520Should%2520Use%2520in%25202021-4.png)

The  [**Download Artifact**](https://github.com/marketplace/actions/download-a-build-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.

## 6. Create Pull Request

![image8](https://assets.website-files.com/6294d502b5093e3965b91f4d/62bed525f757593899369ac2_Top%252010%2520GitHub%2520Actions%2520You%2520Should%2520Use%2520in%25202021-1.png)

[**Create Pull Request**](https://github.com/marketplace/actions/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.

## 7. Automerge

![image8](https://assets.website-files.com/6294d502b5093e3965b91f4d/62bed52404acdfb995b8fd61_Top%252010%2520GitHub%2520Actions%2520You%2520Should%2520Use%2520in%25202021-Oct-14-2021-07-32-32-56-AM.png)

[**Merge pull requests**](https://github.com/marketplace/actions/merge-pull-requests-automerge-action)  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.

## 8. Docker Build & Push Action

![image9](https://assets.website-files.com/6294d502b5093e3965b91f4d/62bed52504acdf96dab8fd62_Top%252010%2520GitHub%2520Actions%2520You%2520Should%2520Use%2520in%25202021-Oct-14-2021-07-32-33-32-AM.png)

[**Docker build and push action**](https://github.com/marketplace/actions/docker-build-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.

## 9. Slack

![image11](https://assets.website-files.com/6294d502b5093e3965b91f4d/62bed525311733774a6a866d_Top%252010%2520GitHub%2520Actions%2520You%2520Should%2520Use%2520in%25202021-Oct-14-2021-07-32-32-80-AM.png)

[**Slack Notify**](https://github.com/marketplace/actions/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.

## 10. Foresight

![](https://assets.website-files.com/6294d502b5093e3965b91f4d/62c6a52d8e4764e3f5d1242d_Screen%20Shot%202022-07-07%20at%2012.19.30.png)

[**Foresight GitHub app**](https://github.com/marketplace/thundra-foresight)  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**](https://www.runforesight.com/)  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.

![image15](https://assets.website-files.com/6294d502b5093e3965b91f4d/62bed525b5d9b80aa352b934_Top%252010%2520GitHub%2520Actions%2520You%2520Should%2520Use%2520in%25202021-2.png)

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**](https://www.producthunt.com/upcoming/foresight-ci-test-monitoring-for-github-actions) **💜**
[](https://www.producthunt.com/upcoming/foresight-ci-test-monitoring-for-github-actions)

![](https://assets.website-files.com/6294d502b5093e3965b91f4d/631b1da59b02dabd4c193ad6_unnamed.png)