Skip to content

How to trigger different action only on merge #25354

Discussion options

You must be logged in to vote

Hi @danielinclouds ,

Merge pull request will not trigger the workflow. By default, the pull_request’s activity type is opened, synchronize, and reopened. Hence you need to add ‘closed’ type for pull request event. Code sample as below:

name: Test

on:
push:
branches-ignore:
- master
<font color="#FF6600"> pull_request:
types:
- opened
- reopened
- synchronize
- closed</font>jobs:

build:
name: Testing
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"

  - name: Step 1
    run: |
      echo " Step 1"

  - name: Step 2
    if: github.event.pull_request.merged == true
    run: |
      echo " Step 2"

Hope it’s clea…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants