Blog

  • Home
  • Blog
  • Improve DevOps pipelines with PowerAutomate

Improve DevOps pipelines with PowerAutomate

May 7, 2024
Improve DevOps Pipelines with Power Automate

With the evolution of DevOps practices, automation is key to achieving efficient and reliable workflows. GitHub Actions already provides a versatile DevOps pipeline, but adding Power Automate can help you take it even further. In this article, we’ll explore how to enhance your GitHub Actions pipeline by integrating a Power Automate flow to send email (or Slack/Teams messages) and update environment variables whenever a deployment workflow completes successfully.


Why Combine GitHub Actions and Power Automate?

- Centralized Alerts: By leveraging Power Automate, you can automatically send notifications to all relevant team members. This helps ensure everyone is immediately informed about important workflow events.
- Flexible Connectors: Power Automate offers built-in connectors for Outlook, Slack, Teams, and many other services, allowing you to tailor your notification strategy to your team’s communication channels.
- Ease of Setup: Both GitHub Actions and Power Automate feature intuitive user interfaces and robust documentation, making integration straightforward even for teams without extensive DevOps experience.


Prerequisites

1. GitHub Account: Make sure you have permissions to create or modify a GitHub Actions pipeline in your repository.
2. Power Automate License: You’ll need a valid license or trial for Power Automate.
3. Connection to Outlook/Slack/Teams: Ensure you have a connector set up for whichever service you plan to use for notifications.


Step 1: Create or Update Your GitHub Actions Pipeline

1. Open Your Repository in GitHub and navigate to the Actions tab.
2. Select or Create a Workflow that you want to improve with notifications. If you’re starting from scratch, pick one of the prebuilt templates or create a new YAML-based workflow.
3. Define Your Steps: Make sure your build, test, or deploy steps are properly configured to produce a success or failure status.

An example snippet of a GitHub Actions workflow might look like this:

// define notification object name: Build and Test on: push: branches: [ main ] pull_request: branches: [ main ] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Run Build run: | npm install npm run build - name: Test run: npm test



Step 2: Build the Power Automate Flow

1. Log In to Power Automate https://make.powerautomate.com.
2. Create a New Flow: Select the **Automated Cloud Flow** option to trigger on a specific event.
3. Set Your Trigger: Depending on how you want to integrate, you can use a GitHub webhook or a manual button trigger for testing. In our case, we will chose the "http" connector (When a HTTP request is received)
4. Add Outlook/Slack/Teams Connector:
  • Outlook: Use the “Send an email (V2)” action, specify recipients, and fill in the subject and body.
  • Slack: Use “Post message to Slack” action, choose the relevant channel, and write a concise message.
  • Teams: Use the “Post a message (V3)” action, select the channel or user, and craft your notification.
5. Save & Test: Save your flow and test it to ensure it sends notifications correctly.


Step 3: Connect GitHub Actions to Power Automate

To trigger your Power Automate flow from GitHub Actions, follow one of these approaches:

1. Webhooks:
- In your Power Automate flow, select **When a HTTP request is received** as the trigger.
- Copy the URL from the trigger and add it to your GitHub Actions workflow as a step:
- name: Trigger Power Automate Flow run: | curl -X POST -H "Content-Type: application/json" -d '{ "param1": "value1" }'
- This sends an HTTP request to Power Automate whenever the workflow runs.

2. Manual Trigger: You can start the Power Automate flow manually during your GitHub Action steps. While this approach is less automatic, it might be useful for demonstration or testing.

PS : The HTTP URI will be given to you in Power Automate. Anytime this URL will be called with the proper atributes, it will run your Power Automate Flow. In the parameters of the API Call you can set the version of application deployed, the status (success/failed), and any other type of values required in you teams/outlook notification.



Step 4: Validate the Integration

1. Commit Changes to your GitHub repository.
2. View the Actions Tab: Watch the pipeline run.
3. Check Your Emails/Slack/Teams: You should see a notification once the workflow completes successfully.


Conclusion

By integrating Power Automate into your GitHub Actions workflow, you create a more robust DevOps process. Power Automate provides a powerful way to distribute critical updates to the right people, using connectors like Outlook, Slack, or Teams. This ensures that everyone involved is informed about a successful run—or quickly alerted if something goes wrong. Start building more efficient pipelines today by combining the strengths of GitHub Actions and Power Automate!
cookie
Cookies Consent

We use our own and third-party cookies to personalize content and to analyze web traffic.

Reject all