tomasbjerre / pull-request-notifier-for-bitbucket

Bitbucket Server plugin that invokes a custom URL when a pull request event is triggered.
Other
185 stars 74 forks source link

Add commit messages variable #181

Open itay opened 7 years ago

itay commented 7 years ago

It would be nice to have a variable that had all the commit messages from the commits in the PR. In an ideal world it would look similar to what "git merge --squash" creates, e.g.

    commit d6be3b6ecc19cf6d114d1a7af0ca9a7330471197
    Author: ineeman <ineeman@splunk.com>
    Date:   Sat Dec 3 11:17:50 2016 -0800

    Squashed commit of the following:

    commit 282a943939d4d6d6ec08105920ce0783850604fd
    Author: Itay Neeman <ineeman@splunk.com>
    Date:   Fri Dec 2 19:52:24 2016 -0800

        foobar bar

    commit 45221ab5c38fda8e308f3cbe5ec3019d12e2e6f6
    Author: Itay Neeman <ineeman@splunk.com>
    Date:   Fri Dec 2 19:49:02 2016 -0800

        foobar

    commit 14ba3095d14152a40622040cc11dd93843a11a39
    Author: Itay Neeman <ineeman@splunk.com>
    Date:   Fri Dec 2 19:48:19 2016 -0800

        bar

    commit 3becd76ba0d7c69525e15430b114e467d597a2a0
    Author: Itay Neeman <itay2@neeman.net>
    Date:   Fri Dec 2 19:39:31 2016 -0800

        Test commit 6

but I'll take anything :)

tomasbjerre commented 7 years ago

If you use this plugin to get from/to hashes. Then you may use Git Changelog Plugin to get those messages. With another REST call to /{project}/{repository}/fromcommit/{fromCommit}/tocommit/{toCommit}.

Does that help?

I guess you have limited options here for some reason. You cannot do the git commands yourself right? And also perhaps not another rest call.

itay commented 7 years ago

I'm looking to give people a button that will squash all their commit messages for them, but id like them to be able to edit that commit message with the new form capability.

However, to do that I need to have the combined commit messages to begin with, which is all on the Bitbucket side, and thus no ability to run any REST calls or Git commands.

Does that make sense?

tomasbjerre commented 7 years ago

Yes =)

Perhaps its possible to invoke the changelog plugin and get the response into the ${INJECTION_URL_VALUE} variable. And then use that variable in the button form.