What is GitHub Actions? (With 2 Examples)

GitHub Actions is a new service continuous integration and continuous delivery (CI/CD) service from GitHub that allows you to automate your build, test, and deployment pipeline.

With GitHub Actions, you can create automated pipelines that can test, build, and deploy on every push or pull request to your repository.

What is GitHub Actions?

Continuous integration and continuous delivery (CI/CD) are key practices for modern software development teams. CI/CD enables automated building, testing and deployment of code changes to accelerate release cycles.

What is GitHub Actions?

GitHub Actions is a relatively new, but powerful player in the CI/CD space. It allows you to create custom automated workflows directly within your GitHub repositories.

With GitHub Actions, you can configure custom workflows using YAML files checked in to your repo. These workflow files can trigger on various events like code pushes, pull requests and releases.

Jobs and steps defined in the workflows can leverage GitHub Actions from the marketplace or run custom scripts and containers.

Key Concepts of GitHub Actions

Some key concepts of GitHub Actions include:


A workflow is an automated process that you can set up in your repository to build, test, package, release and deploy your code. Workflows are defined using YAML syntax and are stored as files in the .github/workflows directory.


An event is a specific activity that triggers a workflow run. For example, common events are push, pull_request and release. You can configure a workflow to run when one of these events occurs in your repository.


A job is a set of steps in a workflow that execute on the same runner. A workflow can have multiple jobs that run sequentially or in parallel.


A step is an individual task that can run commands or actions. Steps can be reused, combined, and ordered to create jobs.


Actions are standalone commands that can be combined into steps and jobs. GitHub provides many pre-built actions for common tasks, or you can create your own custom actions.


A runner is a server that has the GitHub Actions runner application installed. It listens for available jobs, runs one job at a time, and reports the progress, logs, and results to GitHub.

You can also use self-hosted runners to run your workflows.

GitHub Actions: Example Workflow

Example Workflow with 1 Job

Here is an example workflow that checks for the OS release whenever code is pushed to the branch:

name: GH Actions Demo

on: push


    runs-on: ubuntu-latest

    - uses: actions/checkout@v2
    - name: OS Release check
      run: cat /etc/os-release

This is the simplest workflow YAML file with only 1 job. You can have multiple jobs within one workflow and they can run in parallel or can depend upon each other.

This workflow has 1 job – build. The build job checks out the code, and checks for OS release with the help of cat command.

The workflow will run every time the code is pushed to the branch where it is present. You can also change it to every pull request, merge, or even run the workflow on a schedule.

Changing the triggering event or adding more jobs is simple in GitHub Actions.

Example Workflow with 2 Jobs with dependency

Here is an example workflow that contains 2 jobs. Job “deploy” depends upon job “build”.

name: GH Action Demo

on: push


    runs-on: ubuntu-latest

    - uses: actions/checkout@v2
    - name: Run Task 1
      run: echo ---- Running Task 1 ---

    runs-on: ubuntu-latest
    needs: [build]
    - uses: actions/checkout@v2
    - name: Run Task 2 - Random Commands
      run: |
         echo ---- Running Task 2 ---
         uname -a

In the above example, first the job “build” will run and once it is succeeded job “deploy” will run. This is a simple workflow file and you can include any commands to make your deployment process automated.

Like generating artifacts or docker images in the first job and then sending them to the docker registry, ECR, or S3 bucket.

The below screenshot shows what it looks like in the GitHub Actions pipeline.

GitHub Actions Workflow Example

Key Benefits of GitHub Actions

Some key benefits of GitHub Actions include:

  • Automate your CI/CD pipelines
  • Test across multiple versions of your runtime, like Node.js, Python, etc
  • Deploy to multiple environments like development, staging and production
  • Integrate with other GitHub features like pull requests
  • Extend Actions with JavaScript or Docker containers
  • Rich ecosystem of third-party actions
  • Flexible workflows using YAML syntax


In summary, GitHub Actions is a powerful platform to automate your software development life cycle. Using workflows and prebuilt actions, you can easily build, test and deploy. The flexible YAML syntax makes it easy to customize your pipelines for your application’s needs.

Buy me a coffeeBuy me a coffee

Add Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.