Skip to content
WORDPRESS

GitHub Actions

GitHub Actions have been designed to help you create strong and dynamic automation. This blog will show you how to create GitHub Actions workflows with environment variables, customizable scripts, and other features.

Let’s get started!

GitHub Actions workflow to be triggered when an event occurs in your repository like a pull request being opened/an issue pops up. Your workflow has one or more jobs that can run in a sequence or in parallel mode. Each job will run inside its virtual machine runner or a container and has varied steps that either run a script you define or an action, a reusable extension that can ease your workflow.

Creating GitHub Actions

GitHub Actions uses YAML syntax to define the workflow. Each workflow is stored as a separate YAML file in your code repository, in a directory named .github/workflows.

Go to Actions and search for the needed workflow. Our projects uses NodeJS. So, We can search for the Webpack workflow and configure.

Now, we can configure our .yml file with action step by step which will be executed sequential order.

How To Use GitHub Action Secrets?

It can save any private data required in your GitHub actions workflow. They are built as key/value pairs at the repository or organizational level by adding secrets before your secret name as a YML variable.

${{ secrets.MY_SECRET_TOKEN }}
How To Mask Secrets?

In your repository on GitHub, click the Settings tab, select Secrets and variables > Actions from the left sidebar, and then click New repository secret to add a new secret.

Give your secret a name and a secret value, then click Add secret.

You can use it in your workflow file.

Your new GitHub Actions workflow file is now installed in your repository & can run automatically when someone pushes a change to the repository.

Viewing the activity for a workflow run

Once you commit the code & push the modifications to your GitHub repository, the workflow will be triggered. A workflow run is created that executes the workflow. After a workflow run begins, you can see a graph of the run’s progress and view every activity on GitHub.

In your repository on GitHub, click the Actions tab.

In the left sidebar, click the workflow you want to see.

Click on the workflow to check the completed jobs.

Final Words

GitHub Actions is an excellent addition to the GitHub feature set. It allows you to automate development tasks and visualize how they are carried out within GitHub.It can automate CI/CD processes like issue triage and pull request labeling.

Actions serve as your serverless workflow engine, keeping the automation code separate from the application code. Try it out, and let us know how it works for you!

Need help to start? We are at your disposal!

Reach out to us today!

Abdul Rahuman

Lead Front-End Developer