Overview

This is a memorandum on how to trigger GitHub Actions from Drupal events.

The following site was helpful:

https://qiita.com/hmaruyama/items/3d47efde4720d357a39e

Pipedream Configuration

Create a workflow that includes a trigger and a custom_request.

For the trigger, please refer to the following:

https://qiita.com/hmaruyama/items/3d47efde4720d357a39e#pipedream側の設定

In custom_request, configure the dispatch settings.

https://docs.github.com/ja/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-dispatch-event

Configure the settings as follows:

curl -L \
  -X POST \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repos/OWNER/REPO/dispatches \
  -d '{"event_type":"webhook"}'

Drupal Configuration

Install the following module:

https://www.drupal.org/project/webhooks

After installation, configure it on the following page:

/admin/config/services/webhook

GitHub Actions Configuration

Configure repository_dispatch as follows. This allows GitHub Actions to be executed based on requests from Pipedream.

name: Build and Deploy to Production

on:
  push:
    branches:
      - main

  # Allows external webhook trigger
  repository_dispatch:
    types:
      - webhook

permissions:
  contents: read

concurrency:
  group: "build-and-deploy"
  cancel-in-progress: true

jobs:
...

Summary

It may also be possible to send notifications to GitHub by creating a custom Drupal module without using Pipedream. (Such a module has likely already been developed, but I was unable to find one.)

I hope this serves as a useful reference.