Getting Started with GitHub Actions

GitHub is an internet-based hosting service for software development projects that use the Git revision control system. The “Git” in GitHub means a version control system that simply means a system that stores the modification done by a coder and the Hub is the center of all the things including git is a Hub.

GitHub Actions:

GitHub Actions helps the user to create a custom software development lifecycle directly in the GitHub repository. It contains continuous integration and continuous delivery (CI/CD) platform, which allows users to build and test the workflows. In this platform, any user can create workflows and can test every pull request to the repository.

These are the core concepts that are used in the GitHub actions:

  • Actions:

They are the smallest building part of a lifecycle or a workflow. The best part of the platform is users can create their own Actions or can use already shared actions from the Marketplace.

  • Events :

They are activities that particularly focus on a workflow run. They can also be configured to listen to external events using Webhooks.

  • Runner:

It refers to a machine that works with the GitHub runner application. It helps in executing the available jobs and after picking up the job the report of the progress and results comes back to GitHub.

  • Job:

A job consists of many steps in a virtual environment. They can be run independently of one and another or it can be run sequentially like if the ongoing job depends on previous job to be successful.

  • Steps:

Step can be the process or the tasks run by commands/actions.

  • Workflow:

It includes automated process made of multiple jobs that can be triggered by an event. It is defined in “.github/workflows” directory in a repository.

General syntax:

The GitHub actions are written using the language “YAML”.yml or .yaml file extension.
The most important concepts under the syntax are as follows:

  • Name:

The name of the workflow which is displayed on Action page in GitHub. If the user omits this then the default settingset to “file name”

Syntax:

name: Continuous Deployment On:
The “on” keyword defines events that focuses on the workflow.

  • Jobs:

A job consists of many steps in a virtual environment. They can be run independently of one and another or it can be run sequentially like if the ongoing job depends on previous job to be successful.

jobs:

my-job:
name: My Job
runs-on: ubuntu-latest
steps:
– name: Print a greeting
run: |
echo Hello there!

  • Env:

It defines the environment variable which are available to all the jobs and steps in workflow.

env:
CI: true

Viewing Workflow Activity:

When your workflow is triggered, a workflow run is created that executes the workflow. After a workflow run has started, you can see a visualization graph of the run’s progress and view each step’s activity on GitHub.

Steps:

  • On GitHub.com, navigate to the main page of the repository.
  • Under your repository name, click Actions.
  • Navigate to repository
  • Under Jobs or in the visualization graph, click the job you want to see.
  • Select job
  • View the results of each step.

Conclusion:

GitHub Actions helps the user to create a custom software development lifecycle directly in the GitHub repository. It contains continuous integration and continuous delivery (CI/CD) platform.

So, these are the basics for understanding GitHub Actions which include core concepts, syntax, and viewing the workflows using various steps.