Automation trigger: 'Commit Created' does not account for merge commits

Josué Garcia April 19, 2023

I am setting up some automation rules to capture {{commit.hash}} for every commit created using the 'When Commit Created' trigger.  The rules does get triggered when I make a commit to my dev branch (b458626). After merging to the 'main' branch, this merge commit does NOT trigger the rule (a1ed54d). Is the rule making a distinction between a commit and a merge commit?

 

 

merge.PNG

1 answer

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 20, 2023

Are you merging it "manually" or with a pull request?

Because, for pull request merges, there is another trigger type: https://support.atlassian.com/cloud-automation/docs/jira-automation-triggers/#Pull-request-merged

Josué Garcia April 24, 2023

Hi Aron, this is for manual merges without issuing a pull request. I was hoping the automation rule would trigger on all commits and just filter using {{isMergeCommit}} smart value.

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 24, 2023

I checked out their docs, and they don't mention if they differentiate between "regular" and "merge" commits, so I would assume the same like you did. But, it seems it is not how it is... :-/

Funnily, we develop the DevOps Automation app for self-hosted Jira, and our Commit Created trigger works as you wrote: we provide a {{devops.commit.isMerge}} smart value which you can use to filter merge commits:

commit-created-trigger.png

You confirmed that it is an intuitive design. :-)

Sriram Ramanathan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 20, 2024

How do I get the commit hash for a merge commit

If I use Pull Request Merge, I am not getting the {{commit.hash}} value in it (as it gets set only on commit created trigger

If I use commit created trigger, then it is not getting fired for a merge commit 

Suggest an answer

Log in or Sign up to answer