GitHub Actions Workflow Part 1 – Name On

GitHub Actions Workflow Part 1 – Name On

GitHub Actions Workflow Part 1 – Name On

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In today’s blog post, we will discuss the name and on elements of GitHub Action workflow and will have a demo on how to trigger a GitHub pipeline manually using API.

name (optional): You can define the name of your workflow using name parameter in GitHub action workflow. GitHub uses the value of name parameter in the repository action page. If you omit name, GitHub sets it to the workflow file path relative to the root of the repository.

on (required): The name of the event that will trigger your GitHub workflow. You can define multiple events as trigger for your GitHub workflow.

You can also define branches for push and pull request events.

In some events, you can also define the event types.

Instead of event, you can also define a schedule to trigger your GitHub workflow.

You can also manually trigger the pipeline using repository_dispatch or workflow_dispatch events as explained in the demo.

How To Trigger A GitHub Action Workflow Manually Using API

Prerequisites:

Step 1: Create a new GitHub repository for this demo.

Step 2: Create a workflow file for your GitHub CI/CD pipeline.

Step 3: Upload the workflow file in your GitHub repository.

Note: The workflow will not get triggered automatically since we have given “on: workflow_dispatch” parameter in our GitHub workflow file.

How To Trigger A GitHub Action Workflow Manually Using API

You can manually trigger this pipeline from the GitHub UI or API. We will trigger the workflow using API.

Step 4: Get the GitHub workflow id using API.

Step 5: Trigger the GitHub Actions Workflow Manually Using API

Step 6: Get the workflow execution details.

You can also check from GitHub repository under Actions.

How To Trigger A GitHub Action Workflow Manually Using API

Step 7: Delete your GitHub repository using API.

Hope you have enjoyed this article. To know more about GitHub, please refer below official documentation

https://docs.github.com/en

Leave a Reply

Close Menu