GitHub Actions is a powerful automation tool for CI/CD workflows, while Power Automate streamlines business processes. Integrating Power Automate with GitHub Actions allows you to automate notifications, track repository changes, trigger workflows, and improve development productivity.
This guide will walk you through setting up Power Automate to interact with GitHub Actions effectively.
Step 1: Set Up GitHub and Power Automate
1.1 Create a GitHub Account
If you don’t already have a GitHub account, sign up at GitHub.
1.2 Create or Identify a GitHub Repository
Ensure you have a repository where GitHub Actions workflows will be triggered.
1.3 Generate a GitHub Personal Access Token (PAT)
To allow Power Automate to interact with GitHub, generate a Personal Access Token (PAT):
- Go to GitHub > Settings.
- Navigate to Developer settings > Personal access tokens.
- Click Generate new token (classic).
- Select necessary scopes:
repo
(Full control of private repositories).workflow
(Trigger GitHub Actions workflows).admin:repo_hook
(Manage webhooks).
- Generate the token and copy it for later use.
1.4 Access Power Automate
- Open Power Automate.
- Sign in with your Microsoft account.
- Click Create to start a new flow.
Step 2: Create an Automated Flow in Power Automate
2.1 Choose a Trigger
- Click Create and select Automated cloud flow.
- Name your flow (e.g., “Trigger GitHub Action from Power Automate”).
- Choose a trigger based on your use case:
- Manually trigger a flow (for manual execution).
- When an item is created in SharePoint (for automated workflows).
- When a new issue is created in GitHub (requires GitHub connector).
For example, if using a manual trigger:
- Select Manually trigger a flow.
- Click Create.
Step 3: Define GitHub Actions in Power Automate
3.1 Add an HTTP Request to Trigger a GitHub Action
Since Power Automate does not have a direct GitHub Actions connector, use the HTTP request action:
- Click + New step.
- Search for HTTP and select HTTP request.
- Configure the request:
- Method:
POST
- URI:
https://api.github.com/repos/{owner}/{repo}/actions/workflows/{workflow_file}/dispatches
Replace{owner}
,{repo}
, and{workflow_file}
with your GitHub details. - Headers:
{ "Accept": "application/vnd.github.v3+json", "Authorization": "Bearer YOUR_PERSONAL_ACCESS_TOKEN" }
- Body:
{ "ref": "main" }
(Change"main"
to your branch name if needed.)
- Method:
- Click Save and Test the flow.
Step 4: Automate GitHub Actions Notifications
4.1 Send a Teams Notification When a Workflow Runs
- Click + New step.
- Search for Microsoft Teams and select Post a message.
- Configure the message:
- Team: Select the team.
- Channel: Choose a channel (e.g., “DevOps Updates”).
- Message:
A GitHub Action workflow has been triggered for the repository: {repo}.
- Click Save and Test the flow.
Step 5: Monitor and Manage Your Flow
- Go to My Flows in Power Automate.
- Click on the flow to check its run history.
- Modify or update flows as needed.