The Startup
Published in

The Startup

Trigger GitHub actions with Azure DevOps Pipelines

DDDPerth’s website team are in the midst of a site refresh. There are many goals guiding the refresh but a significant one was gaining insight, and improving, our performance and accessibility.

A convenient method to gather these metrics is an automated step within the CD process. There’s a few services to choose from but we opted for Lighthouse-CI. It has a GitHub Action, making setup quick and easy, and Lighthouse scores provided the desired metrics. With that settled, how would this work in our pipeline?

Trigger a GitHub action

The first step is triggering an Action outside of GitHub. I hoped that because Microsoft own both Azure and GitHub, there would be a task ready to go. Sadly not (yet). Actions can be triggered on releases and merges but how to do an external trigger? A bit of googling brought me to the repository dispatch event API endpoint.

From GitHub’s documentation:

You can use this endpoint to trigger a webhook event called repository_dispatch when you want activity that happens outside of GitHub to trigger a GitHub Actions workflow or GitHub App webhook.

Perfect. The POST endpoint is /repos/:owner/:repo/dispatches. Replacing :owner and :repo for your GitHub username and repository name. The endpoint requires an event_type string parameter, this is the name of the event. There’s also an optional client_payload JSON object parameter if you want to send extra information. Say for configurable Actions.

Configure the action

The repo’s actions will live in the workflows directory and have a YAML configuration file. Setting the `on` attribute to `repository_dispatch` enables the action to be triggered when the repository dispatch event endpoint is called.

on: [repository_dispatch]

With the on event defined it’s possible to test at this point by hitting that endpoint in an application like Postman. If successful you should see the Action in the repo’s workflow run page.

Azure DevOps

DDDPerth’s build pipelines are in Azure DevOps but if you’re able to call a REST endpoint then you’ll be able to achieve the same in other systems.

Calling a rest endpoint in Azure

Navigate to your build tasks and, if you don’t yet have an agentless job, you’ll need to add one. Select the three dots and choose “Add an agentless job”.

Azure DevOps task interface. Drop down menu showing three options. The last being Add an agentless job

Add a task to your agentless job, choosing “Invoke REST API”.

Configure REST API task

We need to authenticate to the GitHub API. A good way to do this is creating a generic service connection for the GitHub API (

The account that has at least write access to the repository is the username. The password will be a personal access token you create. Read through GitHub’s documentation for personal access tokens. The scope, or permission, of the token needs to be public_repo.

The remaining settings set the method to POST, the content-type header as application/json and the body to have the required event_type parameter.

Invoke REST API interface showing DDDPerth’s setup for calling GitHub dispatch event endpoint

With this task in your pipeline it will now trigger the GitHub action each time the task runs. In the case of DDDPerth that means Lighthouse-ci tests are run during each deployment.


  1. Add GitHub action
  2. Action’s on event: on: [repository_dispatch]
  3. Agentless Job in Azure DevOps build task
  4. Invoke REST API task
  5. GitHub Access Token with scope public_repo
  6. POST
  7. Content-Type: “application/json”
  8. Body: { “event_type”: “EVENT_NAME” }


I did not go into this with experience of Azure DevOps. With that in mind, thanks to my DDDPerth teammates, Rob Moore and Mo Zaatar for pairing on the Azure side. And to those that gave valuable input when I asked on Twitter, Amy Kapers and Edward Thomson.





Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +756K followers.

Recommended from Medium

Cozy Collecting, Part 1: Pinging an API & Creating JSON in R

How to: Area and Iteration organization charts on Azure DevOps

Templates are here!

KnightL on a Chessboard


When we say “Sprint Planning”…?

Using Gradle to switch between local and Cloud Appium Java runs

How a Graph DBMS remodeled the Asset Mangement System for Electric Power Company

Bit Manipulation (Part I)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Anton Ball

Anton Ball

More from Medium

Pulumi Boot Camp Part 2

CI/CD of Power Platform using Azure DevOps and GitHub

What Is DevOps? All Questions Answered

Agile vs DevOps