Any way to tell when a push is triggered because of a merged PR?

I’m automating the releasing of code after every relevant PR is merged via an action, so I trigger my workflow on merged PRs. But there’s also the chance of a direct push to the  master branch, so I also want to trigger for pushes as well.

The problem is that right now a merged PR triggers 2 runs: once for the merged PR and once for the push tdue to the merge. Is there some way to tell that the push is due to a merged PR and thus skip it via an if clause so just the merged PR trigger runs?

Hi @brettcannon , 

If your merged PR commit message is like “Merge pull request ***”

Then you could use if conditional to filter commit message, add it to job: 

if: " !startsWith( github.event.head_commit.message , 'Merge pull request') "

Then when the commit is from a merged PR, the job will be skipped. 


@yanjingzhuunfortunately it’s not as I use the title to automatically update the changelog.

Could you please share your scenario in more details? I am not very clear about " I use the title to automatically update the changelog.