Skip to main content

Running a GitHub action on pull request merge

Github workflows can be triggered by a variety of events. The pull_request event has 14 different activity types. I recently wanted to write an action that runs after a pull request is merged and I was surprised to find that merged is not one of the supported activity types. This is easy enough to work around using the following snippet, but a surprising omission.

on:
  pull_request:
    types: [closed]

jobs:
  my-job:
    if: github.event.pull_request.merged == true
    steps: ...